On 27 Feb 2011, at 09:58, leledumbo wrote:

> Read the docs. If the size of the argument is greater than native pointer
> size, it would be passed by reference.

If the docs say that somewhere, they are wrong. How a "const" parameter is 
passed is an implementation detail (which hence could change at any time), 
except for "stdcall" routines on Windows platforms (for COM compatibility).

The only thing 'const' means is that the programmer tells to the compiler that 
this parameter will not change inside the called routine (if it nevertheless 
does, the generated code may be invalid). Based on that information, the 
compiler can perform additional checks (catching direct assignments to the 
parameter inside the routine) and optimizations (passing it by value/reference 
depending on the size and target platform, not performing reference count 
adjustments, ...).


Jonas_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to