[fpc-devel] New language idea: Unified types(assignmentsize-compatible types).

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Jun 21 13:09:36 CEST 2011


Skybuck Flying schrieb:
> Not really, because if the platform changes from 32 bit to 64 bit then 
> other types would change too.
> 
> For example type declared as being longword would change to uint64.

Please understand generic types first.

A LongWord will always have 32 bits, because it's a concrete type. 
Instead Integer, Cardinal, Char, String or Real can vary with every 
compiler version or target platform, because these are *generic* types.

BTW I don't know of *any* language that changed "long" integers to 64 
bits on 64 bit platforms.


Since C has absolutely *no* idea of fixed-size integers, all concrete 
types are subject to conditional definitions in the header files:

#if (sizeof(int)==4)
   typedef int32 int;
#elif (sizeof(int)==2)
   typedef int16 int;
#else
   #error clueless
#endif

#if (sizeof(int*)==4)
   typedef ptr_int int32;
#elif (sizeof(int*)==8)
   typedef ptr_int int64; //hope that an int64 type has been found out
#else
   #error clueless
#endif

DoDi




More information about the fpc-devel mailing list