I'm reading through an email argument regarding the following line of code:
p = (unsigned char)random();
The random function returns a long, and somebody says that this is unsafe because it's possible that the typecast might take the MSB instead of the LSB. I know that on x86 the typecast would return LSB, but I can't find any information as to whether this is actually mandated by ANSI C or if it's one of those implementation-specific "undefined behaviors".