[fpc-pascal] const records passed incorrectly
Jonas Maebe
jonas.maebe at elis.ugent.be
Mon Nov 16 16:39:39 CET 2009
On 16 Nov 2009, at 15:51, Jonas Maebe wrote:
> The main problem with changing it now would obviously be that it
> would break backwards compatibility with existing code. It could
> still be done in Delphi mode onlu, of course, but changing the
> behaviour of a calling convention (which is normally an ABI issue)
> based on a language syntax mode feels... not right.
FWIW, there was a similar problem with the Mac OS X interfaces: these
were generated based on the calling convention used by MetroWerks
Pascal, which passes all const record parameters (regardless of their
size) always by reference, but which is otherwise identical to our
cdecl. The solution there has been to simply add an "mwpascal" calling
convention. We can always add a delphicdecl (or similar calling
convention), and then you'd need only one define at the start of your
code:
{$define cdecl:=delphicdecl}
Since most large projects already have a common include file for all
sources, it shouldn't cause that much work. Also, to implement
something like that you either need a detailed description of all the
behaviours (which there does not appear to be for cdecl in case of
Delphi), and/or an extensive test for all types (even with the
description, you need the test to verify the implementation). That's a
lot more work than the actual implementation work itself.
Jonas
More information about the fpc-pascal
mailing list