Florian Klaempfl wrote:
> Peter N Lewis wrote:
>> If FPC implements "const var", then this issue will die (except for
>> minior compatibility issues with the EOLed MW Pascal).
>
> I must admit, I don't like the const var syntax. Reasons:
> - it's not necessary to determine per parameter the way how "const"
> parameters are passed, it's enough to tell the compiler: let this
> function/(call) look like it was generated by a MW compiler
> - const var influences only the code generation and makes neither a
> syntactic nor a semantic difference visible to the user so it should
> exposed as little as possible to the user
> - adding the const var to interface units is error prone
> - it might be possible that some has a MW compiled library with an
> interface unit: adding the const var is error prone, adding an ifdef'ed
> {$calling mwpascal} is easy.
>
> Did I overlook something?
Yes.
The issue is not "how do I interface with a MW compiled library that
has an interface unit with CONST parameters".
First, this is mostly a hypothetical issue
Second, the MW compiler is dead
Third, such a library had better be recompiled
Fourth, CONST parameters in a Pascal interface library are a bad idea
(as pointed out by Peter)
Fifth, CONST parameter calling conventions seem to vary between
different MW compilers (!)
The real issues are:
1. Question - what is the most efficient calling convention for CONST
parameters in USER code. Answer - let the compiler figure that out for
each type, dependent of type and size.
2. Question - what convention to use for constant parameters where an
EXTERNAL ABI passes them by reference. Answer - use CONST VAR.
Regards,
Adriaan van Os
_______________________________________________
MacPascal mailing list
MacPascal@list...
http://lists.sonic.net/mailman/listinfo/macpascal
opensubscriber is not affiliated with the authors of this message nor responsible for its content.