[fpc-devel] Question on constref

Adriaan van Os adriaan at adriaan.biz
Thu Feb 2 08:03:04 CET 2023


Sven Barth via fpc-devel wrote:

> I doubt that records larger than say 4 register widths are ever passed 
> by-value. But I definitely can't exclude it, cause I don't know every 
> ABI of every platform by heart. So if you want details there then study 
> the ABIs of the platforms you use.

I doubt that any ABI would say something about Pascal "const" rather than C "const". So, that 
argument doesn't hold. The only reason I can possibly think of (for "const" to pass large 
parameters by value and thus violating the rule that "const" chooses the most efficient method) is 
compatibility with Delphi in delphi compiler mode. If that's true, which I don't know, it should be 
documented. Otherwise, "const" will continue to puzzle programmers - and in a year we will have the 
same discussion again.

Regards,

Adriaan van Os


More information about the fpc-devel mailing list