Neil Carlson wrote:
> It would be much better
> to provide a subroutine variant of the function in which the
> array was passed as an argument and filled directly. Comments?
I doubt any compiler would generate temporaries for the simple assignment you
gave. Do you really need a function--if not, use a subroutine? That is, will
you use this function in real *expressions* (formally the RHS is an
expression, but it matters not if it has no operations in it), or in other
"temporary" ways (where you do not want to declare a place to permanently
store the result). If you do:
array=array_function(...)+2*array_function(...)
then this may create a temp, but some optimization may still be done.
Best,
Aleksandar
|