[SDL] newbie SDL_endian question
adam at preston.net
Tue Aug 13 22:06:01 PDT 2002
I recommed NEVER not to imply its not possible but that it will save
time in the long run
especially if you are not the only who will use the code.
Christopher Subich wrote:
> At 02:12 PM 8/14/02 +1000, you wrote:
>> NEVER read in structs as a chunk!
>> As well as endian issues
>> you also have to deal with packing issues
>> as well type size issues.
> I've dealt with some of this in a little bit of network code -- I'm not
> sure if "NEVER" is the best guideline.
> Use caution, yes -- the issues are quite valid. Only use component
> types of defined size, definitely.
> Packing is possible, though, if you're absolutely sure to use all of
> your compiler's packing options for that section of code. #pragma
> pack(1) becomes extremely useful when you're trying to create a 15-byte
> network packet.
> "It startled him even more when just after he was awarded the Galactic
> Institute's Prize for Extreme Cleverness he got lynched by a rampaging
> mob of respectable physicists who had finally realized that the one
> thing they really couldn't stand was a smart-ass."
> -- Hitchhiker's Guide to the Galaxy
More information about the SDL