1
General / Re: Parameter passing oddities
« Last post by Nitorami on Today at 09:59:28 am »When I call your example as "add (C1,C2,C1)", then C1 will be changed. The compiler cannot detect that, it does not know that two parameters are at the same address.
So I do change a const parameter.
The wiki says on constref (https://wiki.freepascal.org/Constref): "not only the parameter, but also the variable (...) passed by the caller (...) must not be changed until the call with the constref parameter has returned."
So - is that legal or not ?
So I do change a const parameter.
The wiki says on constref (https://wiki.freepascal.org/Constref): "not only the parameter, but also the variable (...) passed by the caller (...) must not be changed until the call with the constref parameter has returned."
So - is that legal or not ?