Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Size of anonymous struct standard conformant?

Tags:

c

c99

c89

ansi-c

In C89 and C99: Is sizeof on anonymous structs standard conformant?

sizeof(struct{long l; void* ptr;})
like image 492
Random Citizen Avatar asked Oct 30 '25 18:10

Random Citizen


1 Answers

The expression sizeof(struct{long l; void* ptr;}) is syntactically valid in all versions of the C standard. Syntactically, sizeof(struct{long; void *ptr;}) conforms to sizeof ( type-name ). A type name is syntactically a declaration of a function or an object of that type that omits the identifier.

like image 177
Ian Abbott Avatar answered Nov 01 '25 07:11

Ian Abbott



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!