when I build the code, the result print out likes
“expected primary-expression before “)” token”
“expected ‘;’ before ‘{’ token”
“expected promary-expression before ‘.’ token”
and I try to using mbed class online complier (not yotta), the function can be complie & the outcome is compling pass.
So, my question is: the function return style is illegal in yotta’s complier rule or not?
This is an interesting one. It’s not valid code according to gcc 4.8 and gcc 5.3, but Apple LLVM 7.0.2 compiles it fine.
I’m fairly sure that on mbed Classic we use armcc to compile, whereas on yotta it depends on your target (but presumably you’re using a gcc target), so it could be that armcc also implements this construct, which explains this behavior. Unfortunately I don’t have an armcc copy laying around, so I can’t verify.
If you have a license for armcc, switching to an armcc target would be the easiest.
Unfortunately, I have no license for armcc too, so I can’t verify the result of compiling using armcc by yotta.
but In this case, If I want to return the same result like this example by using gcc, do you know how to modify the code to implement that on gcc compiling?
I think it’s the solution to do that, and I have a new question about running this solution by gcc & past example in armcc.
If we using this solution in gcc, when ARM (like K64F) running into this function. the function looks like create a new private memory size for Test class, named "t’.
if we using the past example code with armcc, does the memory size be created too?