Is register struct legal? In terms of the standards and (independently from the standards) in GCC?
Yes. (No citation, there is simply no prohibition on that. There is a note assuming that the use of register with arrays is valid, and arrays are far more second class citizen in C that structs).
Yes it is legal, however since register is only a hint to the compiler to what it might try, no implementation actually has to listen to it anyway. It is also easy to make a struct that couldnt be stored within the space allotted in registers.
Once you start to get so close to machine dependant problems their part in standards tends to be merely suggestions since hardware varies such that the same things are not reliably possible at this level in all architectures.
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