[fpc-pascal] Can I define a custom "simple" type for my applications?

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Apr 6 22:16:34 CEST 2009


On 06 Apr 2009, at 22:08, Marco van de Voort wrote:

> Oops I apparantly looked at outdated docs (on scenergy):
>
> http://www.freepascal.org/docs-html/prog/progsu59.html#x66-640001.1.59

That documentation is not really complete. The supported settings are:
* FIXED, DEFAULT, NORMAL: the default behaviour, and behaves as  
described in the docs.
* 1, 2, 4: the set size depends on both the low and high value of the  
set element type (e.g., a set of 16..23 will be 1 byte in case of  
{$packset 1}), with
a) the lower bound rounded down to a multiple of the packset setting  
expressed in bits
b) the upper bound rounded up to 'a multiple of the packset setting  
(in bits)' minus 1 (e.g., 24 is a multiple of 8 bits in the above  
example -> -1 = 23)
c) if the set size would be 3 bytes after the above calculation, it's  
changed to 4 bytes
d) if the set size would be greater than 4 bytes after the above  
calculation, it's changed to 32 bytes.
* {$packset 8} is also supported, but kind of nonsensical in the  
current implementation (will always be rounded up to 32 byte, since  
the set size will always be > 4).


Jonas



More information about the fpc-pascal mailing list