[fpc-pascal] Writeable typed constants - what's the point?

Jürgen Hestermann juergen.hestermann at gmx.de
Fri Jun 19 06:59:04 CEST 2009



 > Paul Nicholls schrieb:
> I also find writable constants hand for things like this where I can 
> define the 'variable' + values too so I don't have to set the values at 
> run time:

But can't you do the same with a variable declaration? If you want to 
change the value at runtime it's definitely not a constant anymore.

Beeing able to change a typed constant was added by Borland as a "quick 
hack" (because constants were put into the global data segement even in 
function declarations) but actually its semantic is wrong. If you can 
change it, it has to be a variable declaration and you should not be 
able to change a constant.

Jürgen Hestermann




More information about the fpc-pascal mailing list