Maurice Lombardi wrote:
You may be interested to know the answer given by Borland to the same problem in Delphi 2.0 when going from 16 bit to 32 bit system.=20 The following is a cut out of the Delphi help (in french however):
I don't understand much French, sorry, but I think I can recognize the important words :-)
Type Intervalle Format
Integer -32768 .. 32767 Sign=E9, 16 bits
Integer -2147483648 .. 2147483647 Sign=E9, 32 bits
Cardinal 0 .. 65535 Non sign=E9, 16 bits
Cardinal 0 .. 2147483647 Non sign=E9, 32 bits
If I understand it right, Integer and Cardinal have different sizes on 16 and 32 bit Delphi, right? This would be like in gpc (though not 16 bit, AFAIK, but 64 bit and perhaps more).
Perhaps contrary to Delphi, I don't think LongInt should be 32 bits on every platform, but rather twice as bug as Integer. What do you think?
The idea is exactly the same as that contained in the letter of Frank Heckenbach of today, except for the replacement of=20 Ordinal by Cardinal (which was also suggested by Franck).
That's fine! If Delphi uses "Cardinal", gpc should use it too, of course.
So I would vote to implement what is proposed by Franck, with only the replacement of ordinal by cardinal to have some compatibility. i.e.
Generic Types
Integer Cardinal
I'd add {Short,Long,LongLong(?),Longest(?)}{Int,Card} here.
Well defined types
int8 card8 (=3Dbyte is the only case without doubt) int16 card16 int32 card32
...
card9 =3D 0..2 POW 9 -1 ... if needed: this is always allowed by the pascal syntax but the amount of memory involved is implementation dependant:
Sounds good.
Compatibility types
anything contained in bpcompat.pas delphi1compat.pas delphi2compat.pas and everything you need, better than compiler switches when possible to avoid to garble the compiler by a lot of special purpose oddities: the idea of C to keep a minimum in the compiler and a maximum in libraries is not so bad (when it is possible).
I agree! Except for "integer", all types can be redeclared in these units. (I think, "integer" could be redeclared, too, but AFAIR it's not a good idea to do so, is it?)