I’m now willing to compile my project with -std=c99 and I’m facing an error I’m not understanding for the moment. This line :
my_type* td = ({ register kmy_type* arg0 asm("eax"); arg0; });
gives me the following error only in C99 :
warning: ISO C forbids nested functions
error: syntax error before ‘asm’
error: ‘arg0’ undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
warning: ISO C forbids braced-groups within expressions
Any clues are welcome to help me understanding what this means. I didn’t write this line and I’m also not sure to understand what is its purpose.
The line
should get a value in the
eaxregister, interpreted as a pointer, intotdvariable. However, it uses lots of GNU extensions, particularly statement expressions and this use ofasm(explicit register allocation). I’d suggest you to switch to -std=gnu99 (or whatever it’s called). Otherwise, you might want to play with double underscores (eg.asm->__asm) or the__extension__keyword, but I don’t know if it’ll help in c99 mode.Edit: I just tried it and simply changing
asmto__asmworks.