Mail Archives: djgpp/1999/03/25/08:22:32
In article <Pine DOT GSO DOT 3 DOT 96 DOT 990325095712 DOT 28097B-100000 AT delta DOT ds2 DOT pg DOT gda DOT pl> you wrote:
> > >#if sizeof(long int)==sizeof(int)
> I need something like that in a portable program to check if the structure
> is not larger than a single allocation unit. The exact code is this:
> #if (sizeof(Box) > BOXGRAIN)
> #error Size of Box header cannot exceed size of grain.
> #endif
> Now I know that GCC does and will not support this, so how can I replace
> it?
Strictly spoken, you can't. Actually, you shouldn't even _want_ to do that.
If your program really is meant to be 'portable', it shouldn't rely on
anything as shaky as this. For a portable program, you'ld have to get
rid of all fixed-size limits like that 'BOXGRAIN', above, e.g. by
making a size-independant data structure by use of unions.
Or you might isolate all such inescapable unportabilities in a small,
separate portion of the source code, which will have to be ported from
one architecture to the other, *manually*.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -