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
my_type* td = ({ register my_type* arg0 asm("eax"); arg0; });
should get a value in the eax register, interpreted as a pointer, into td variable. However, it uses lots of GNU extensions, particularly statement expressions and this use of asm (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 asm to __asm works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With