Are there any compilers out there that would make
struct Color{ byte r,g,b,a; };
sizeof(Color) == 16 bytes??? or even 8bytes
No. In fact, no practical compiler would even
try do to that, that's a huge waste of memory. Since these are bytes, on all platforms I've ever heard of they have natural alignment of
1. So they're accessed equally fast no matter where they lie.
Nexus and Laurent are basically playing language lawyers here. And I actually
agree with them on this one. Seriously, how much you'd gain? A thousand cycles in the
whole run of the program? That's
nothing on modern hardware. Heck, that's nothing even on very old hardware (and by very old I mean the things from '70s)! You're really wasting your time trying to optimize this. Furthermore, your code depends on undefined behavior. That's quite bad.
That was just an example. The point is that there's no guarantee that it can fill a 32-bits integer.
My point is that there's no guarantee that it couldn't fill a 32-bit integer, either
Moreover, what's more important, someone could see that and begin to think that RAND_MAX
is 65536 everywhere. It'd be safer to write something like "let's suppose RAND_MAX is 65536..."