Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: Return(Value) and Return Value 1999-02-01 -- Alexey Solovjev > In the C5 help and LRM there is no mentioning of the:
> Return value
> form for Return, only Return(value) - with paranthesis. What are the
> implications of using one form instead of the other? Where are each
> form appropriate and where not?
The difference is very significant if result of the function is an address (reference).
Anything in parenthesis is an expression. Expression is evaluating to produce a value.
E.g.:
MAP
F PROCEDURE(),*LONG
END
L LONG(0)
...
F PROCEDURE()
CODE
RETURN (L)
Here L is evaluating and its value (0) is then converting to "address to LONG".
If there are no parenthesis around variable specified in the RETURN statement it is not
evaluating and its address is returned as result.
Say, in the example above
RETURN L
will return address of L.
There is no difference between these forms if result type is not address (say, just LONG)
or returned value is an expression itself (say, L+1).
Today is November 21, 2024, 3:46 am This article has been viewed 35198 times.
|
|