On 22 Oct 2010, at 21:35, Hans-Peter Diettrich wrote:

> Jonas Maebe schrieb:
> 
>>> What's the guarantee, that (in detail external) subroutines will honor the 
>>> "const" attribute?
>> None. "const" (and constref) is a hint from the programmer that the argument 
>> can be considered by the compiler as "constant" inside the called routine.
> 
> What about reference counting or similar stuff, that differs for const and 
> other arguments?

It's the same for const and constref.

>>> In how far does "constref" affect the *caller*, in contrast to e.g. "var"? 
>>> Can constref pass properties, which are not allowed as var parameters?
>> Right now it's allowed (if the property uses a getter, the getter is called 
>> and its result is put into a temp location whose address is passed), but I 
>> think that's a bug in the implementation.
> 
> When this feature is removed, does there remain any difference between var 
> and constref, at the calling side?

At least you cannot pass a const parameter to a var parameter, while you can 
pass a const parameter to a constref parameter. Since it's always possible to 
take the address of a const parameter (unlike of a property), this is 
semantically consistent.


Jonas_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to