[fpc-pascal] A question about sets performance

Sven Barth pascaldragon at googlemail.com
Tue Feb 1 09:56:25 CET 2011


Am 31.01.2011 22:59, schrieb Jeppe Johansen:
> It's true that the semantics are the same, and it would probably make
> sense to do some optimizations on typed constants that aren't ever
> written to(the FPC rtl "abuses" the typed constant variable property in
> the heap manager code, for example)

I wouldnˈt consider this an abuse as type constants were intended to be 
"static local variables" when they were introduce.

E.g.

procedure IncCount;
const
   count: Integer = 0;
begin
   Inc(count);
end;

The value of "count" will increase throughout the run, but it won't be 
visible to other functions/procedures outside this routine (this goes 
back to the time when Pascal had no units to introduce private variables).

Regards,
Sven



More information about the fpc-pascal mailing list