[fpc-pascal] fpc 2.3.1 doesn't allow to pass literal constants as formal const parameter

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Mar 6 22:29:37 CET 2008


On 06 Mar 2008, at 22:22, Vincent Snijders wrote:

> Peter Vreman schreef:
>>
>> 1. It is passed by value and not by reference.
>
> The compile could decide to pass by reference, couldn't it.

That's what it did in the past, but that's a hack (because it's  
passing a value without an address by reference).

>> 2. You don't know the size of the value.
>
> The caller knows the size, doesn't it.

No, it doesn't. Ordinal constants have no inherent size in Pascal  
(well, in case of TP/Delphi and therefore FPC: most of the time, at  
least).

> Why do you need to know the size?

E.g. on big endian, the memory layout of byte(1), word(1), cardinal(1)  
and qword(1) is completely different.


Jonas



More information about the fpc-pascal mailing list