[fpc-devel] integer, cardinal
Marco van de Voort
marcov at stack.nl
Mon Apr 18 09:22:56 CEST 2005
> On Sunday 17 April 2005 10:45, Ales Katona wrote:
> > First of all Integer should be size independent, that is, xy bits
> > depending on the platform.
>
> I second that.
It is now. It just happens to be the same. However keep in mind that the
strict integer=wordsize bond of the past no longer goes. On most 64-bit
systems, integer is _not_ 64-bit. Mostly because it only unnecessary drives
up memory consumption.
> > Second, we should "force people in a friendly way" to use more
> > readible names like:
> > sint32, uint64, etc. than "cardinal"
>
> No. Such stuff is only needed when you do hardware-interfacing.
> And that's the _only_ reason someone would need types with defined
> bit-sizes.
That's a bit simplistic; Network/system interfacing, binary fileformats ?
> > In a few years when 64 bits are normal, what will cardinal become?
> > who knows..
>
> That's why Pascal has range types. Define the range you need, and don't
> use "just some type" which has the range you think you will need.
I actually tried this in a major app at work. In theory it is nice However
quite a lot of datastructures get written to disc sooner and later, and to
get fileformats size independant, you need a lot of datastructure conversions
(from records with fields that have arch dependant size to packed records
with fields with fixed sized integer types).
More information about the fpc-devel
mailing list