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

Skybuck Flying skybuck2000 at hotmail.com
Mon Jun 27 20:00:22 CEST 2011


Here is a little idea for an automated check or so, to warn if something odd 
is happening or so ;) :):

Assert( SizeOf(byte) = 1, 'SizeOf(byte)(' + IntToStr(SizeOf(byte)) + ') = 
1' );
Assert( SizeOf(word) = 2, 'SizeOf(word)(' + IntToStr(SizeOf(word)) + ') = 
2' );
Assert( SizeOf(longword) = 4, 'SizeOf(longword)(' + 
IntToStr(SizeOf(longword)) + ') = 4' );
Assert( SizeOf(uint64) = 8, 'SizeOf(uint64)(' + IntToStr(SizeOf(uint64)) + 
') = 8' );

Assert( SizeOf(shortint) = 1, 'SizeOf(shortint)(' + 
IntToStr(SizeOf(shortint)) + ') = 1' );
Assert( SizeOf(smallint) = 2, 'SizeOf(smallint)(' + 
IntToStr(SizeOf(smallint)) + ') = 2' );
Assert( SizeOf(integer) = 4, 'SizeOf(integer)(' + IntToStr(SizeOf(integer)) 
+ ') = 4' );
Assert( SizeOf(int64) = 8, 'SizeOf(int64)(' + IntToStr(SizeOf(int64)) + ') = 
8' );

Code is untested but should work ! ;)

Bye,
  Skybuck.




More information about the fpc-devel mailing list