1
General / Re: Parameter passing oddities
« Last post by Nitorami on Today at 09:14:49 pm »Sorry if I did not bring my point across properly.
This
is the only version which is both fast (no copies required), and works with variables as well as function results, e.g. as in add (foo(),C1,C3);
Ok and works, BUT the "const" tells the compiler that a and b will not be changed, while when calling add (C1,C2,C1), "a" WILL be changed.
That is all, and this is what I meant with a calling method which works like "const" or "constref" BUT does not imply the "constness" of variables. The other options are "var" (but does not work with function results which have no address), and passing by value (out of the question because it is abysmally slow). And constref is essentially the same as const in this context.
This
- procedure add (const a,b: complex; out c: complex);
Ok and works, BUT the "const" tells the compiler that a and b will not be changed, while when calling add (C1,C2,C1), "a" WILL be changed.
That is all, and this is what I meant with a calling method which works like "const" or "constref" BUT does not imply the "constness" of variables. The other options are "var" (but does not work with function results which have no address), and passing by value (out of the question because it is abysmally slow). And constref is essentially the same as const in this context.