[fpc-pascal] memory allocation of dynamic array

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Sep 24 15:19:45 CEST 2007


On 24 Sep 2007, at 14:12, mm wrote:

> Jonas Maebe a écrit :
>
>> Counting on implementation details of opaque entities (such as set  
>> formats, anything regarding reference counted types such as when  
>> references are added or removed and when how many references will  
>> exist, rtti format, code generation details such as evaluation  
>> order of parameters [...]
>
> What do you mean with "evaluation order of parameters"?

var
   a: longint;

function f: longint;
begin
   result:=a;
   a:=a+1;
end;

procedure test(a,b: longint);
begin
   writeln(a,' ',b);
end;

begin
   a:=1;
   test(f,f);
end.


The above program can write either "1 2" or "2 1", and what it writes  
out can change between different compiler versions, platforms and  
optimization levels (i.e., the parameter evaluation order is undefined).


Jonas


More information about the fpc-pascal mailing list