[fpc-devel] Passing consts to const

Kornel Kisielewicz charon at magma-net.pl
Tue Jun 7 19:59:56 CEST 2005


David Butler wrote:
> {$WRITEABLECONST OFF}
> 
> procedure TestBuf(const Buf; Size: Integer);
> begin
> end;
> 
> const A : Byte = 1;

 From this point A is treated as a normal variable with an initial 
assignment...

> 
> begin
>   TestBuf(A, 1);

... so it is not const here.

Guess if you would substitute the line
 > const A : Byte = 1;
with
 > const A = 1;

It should work. AFAIR, typed constants are treated exactly as variables 
with an initial value.

-- 
At your service,
Kornel Kisielewicz (charonATmagma-net.pl) [http://chaos.magma-net.pl]
Carceri -- A prelude to GenRogue... Coming Soon




More information about the fpc-devel mailing list