[fpc-devel] Freepascal in microcontrollers

Daniël Mantione daniel.mantione at freepascal.org
Thu Feb 28 09:09:33 CET 2008



Op Thu, 28 Feb 2008, schreef Michael Schnell:

>
>> C-style bitpacking ("char c:1" and "int c:1" are often laid out differently 
>> in C depending on the previous fields,
> Not only this. C defines the layout as implementation depended. I once was 
> bitten by this when porting a networked project from a low endian processor 
> to a high endian processor :( .
>
> Thus if we want binary portability of the structures we need to be better 
> than C (optionally defining the structure as high-endian or low endian on 
> user request) !!!!

Why?

The only thing I want to guarantee is that blockwrite followed by 
blockread on a platform with the same endianness works and will work in 
the future.

This (combined with ifdef based endian conversion) guarantees portability 
of structures to any platform.

Or do I see this wrong?

Daniël


More information about the fpc-devel mailing list