misu kun wrote:
Hi in this program test function has a known return value , and should be calculated in compile time , but fpc make it in real time !!! --------------------- program test; var c : int32; function test( p: int32): int32; inline; var i : int32; begin i := p; test := i+2+c+2+c+2+c; end; begin c:= test(128); end.
The initial value of c is undefined. How do you expect the compiler to optimise it?
In the more general case, my recollection is that C has simpler scoping rules, so there may be cases where it can optimise where a Pascal compiler would be more cautious.
-- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal