[fpc-pascal] Re: Move with pointers to memory

leledumbo leledumbo_cool at yahoo.co.id
Wed Nov 13 17:56:23 CET 2013


> Is there a description of the behaviour of const and var in this case? 

Not so clear: http://www.freepascal.org/docs-html/ref/refsu59.html
A liiiitle bit clearer:
http://docwiki.embarcadero.com/RADStudio/XE5/en/Parameters_(Delphi)#Untyped_Parameters

> Why is it not both const or both var?

If the Dest is const, then it cannot be written to. If Src is var, then the
value might be modified while it's not expected to be. Moreover, const has
no exact passing mechanism, the compiler may choose to pass by reference or
value. Var is always by reference, another reason to mark Dest as var.



--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Move-with-pointers-to-memory-tp5717477p5717489.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.



More information about the fpc-pascal mailing list