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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to