I discovered a bug in the way GPC treats type modifiers:
Consider this snippet, for a 32bit architecture:
-------------------------------------------
type uint = __unsigned__ integer; { unsigned 32-bit }
const c1 : uint = $7FFFFFFF ; { maxint } c2 : uint = $80000000 ;
-------------------------------------------
The declaration of c2 gives this error message: `integer constant does not fit in integer type'
while this faulty snippet is accepted:
-------------------------------------------
type short = __short__ integer; { signed 16-bit }
const c3 : short = $FFFF ; c4 : short = $00010000 ;
-------------------------------------------
Although c4 gives a warning: `warning: overflow in implicit constant conversion'
Obviously, GPC doesn't treat the type modifiers the right way when it evaluates whether a constant is valid or not.
The same is true for __longlong__ (64bit), which cannot be initialized with a value > $7FFFFFFF.
Workaround ========== With this silly trick it's still possible to assign an unsigned 32bit value:
-------------------------------------------
type uint = __unsigned__ integer; { unsigned 32-bit }
const c1 : uint = $7FFFFFFF + 1;
------------------------------------------- This gives again: `warning: overflow in implicit constant conversion'
which can be suppressed by surrounding the declaration with {$W-} .. {$W+}
JanJaap
--- "Nothing shocks me, I'm a scientist", Indiana Jones