[fpc-pascal] const records passed incorrectly

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Nov 16 14:56:32 CET 2009


On 16 Nov 2009, at 14:50, Anthony Walter wrote:

> There is a problem with the above code on FPC when you change calling
> conventions of A.

Const indeed behaves differently depending on the calling convention.  
With register and stdcall, we emulate Delphi. With mwpascal, we  
emulate MetroWerks Pascal. With cdecl, we emulate C compilers. In C  
compilers, adding "const" does not change the way the parameter is  
passed: they are still passed by value. There have been lots of  
discussions in the past about adding something like constvar or  
constref, but nothing has ever come from it.


Jonas



More information about the fpc-pascal mailing list