[fpc-devel] integer, cardinal

DrDiettrich drdiettrich at compuserve.de
Mon Apr 18 07:13:26 CEST 2005

Ales Katona wrote:

> I think that pascal typesystem requires a bit overhaul when it comes to
> integers.
> First of all Integer should be size independent, that is, xy bits
> depending on the platform. All others should be specific.

I agree with an application wide integer/cardinal type, but there should
exist a way to get integers of a minimum size, as required by a specific
program. One may use range types for that purpose, which the compiler
can extend to the next "optimal" byte count, but doing so should not
result in too much range checking.

> Second, we should "force people in a friendly way" to use more readible
> names like:
> sint32, uint64, etc. than "cardinal"

Not necessarily, when integer and cardinal for themselves are

What's the reason for using explicitly sized variables, of different
sizes? I can see only one purpose, in the I/O of records in binary
files. But with regards to different byte orders, reading structured
blocks of binary information is not portable.

> In a few years when 64 bits are normal, what will cardinal become? who
> knows..

32 bit integers will continue to be sufficient for most purposes. Arrays
with more elements are not very likely in the next few years, 64 bit
integers will be restricted to few special purposes (file size).


More information about the fpc-devel mailing list