string literal as const var parameter

Adriaan van Os gpc at
Wed Jun 27 14:55:53 CEST 2012

Prof. A Olowofoyeku (The African Chief) wrote:
> On 27 Jun 2012 at 11:47, Adriaan van Os wrote:
> [...]
>> const var parameters were introduced to interface with external (C)
>> routines where (1) the API requires that the parameter is passed by
>> reference and (2) passing a constant as actual parameter should be
>> allowed. For normal use, const parameters can be used.
> Don't const parameters comply with both conditions?

No, with const parameters, the compiler decides what is more efficient, by reference or by value. 
For small sized parameters, by reference is more efficient. So, an integer const (and probably a 
real const) parameter will be passed by value, which could conflict with the ABI of an external (C) 


Adriaan van Os

More information about the Gpc mailing list