Playing around with #C23 stuff and got surprised by this not working…
void func(void);
typedef typeof(func) func_type;
Since a function name is neither an expression nor a type name, it's not supported as operand to typeof (not sure that's all), fair enough but why? @AaronBallman @thephd
I'd have used it to have the prototypes of a library functions in a header and use the typedef within the "private" .c only. This would avoid the alternative of duplicating the prototype within the typedef.
=> More informations about this toot | More toots from stefanct@chaos.social
@AaronBallman @thephd oh it's even worse, typedef doesnt work with typeof at all AFAICT. or i am stupid. >< *opening the actual standard
=> More informations about this toot | More toots from stefanct@chaos.social
@stefanct @AaronBallman This works across all distributions. I think you need to check your flags.
https://godbolt.org/z/z8YTac4x6
=> More informations about this toot | More toots from thephd@pony.social
@thephd @AaronBallman it was actually simply too old compilers. since typeof was an extension for so long, I got completely thrown off the rails. gcc supports it as a non-extension only since version 13.1.0*. thank you and sorry for bothering you with nonsense :(
(and my initial assumption that a function name isn't an expression was completely bogus too of course - identifiers are primary-expressions).
=> More informations about this toot | More toots from stefanct@chaos.social This content has been proxied by September (ba2dc).Proxy Information
text/gemini