| Re: [Q] readf into an array error [message #5717 is a reply to message #5714] |
Mon, 05 February 1996 00:00   |
peter
Messages: 80 Registered: February 1994
|
Member |
|
|
Ken Knighton (knighton@gav.gat.com) wrote:
: peter@hpl.hp.com (Peter Webb) wrote:
: >This is due to the argument passing mechanism used in IDL. If an array
: >is passed to a function, it is passed by reference. If a subarray is
: >passed, it is passed by value, and thus cannot be overwritten.
: By the way, I found the documentation for this on page 10-7 of the
: user's guide. This documents everything except that structure
: members are passed by value. This tidbit is documented on page
: 7-5 of the user's guide.
As Ken mentions, this behavior is documented. However, the whole
section on argument passing is very badly written. From the PV-Wave
manual, which I believe is a direct copy of the IDL manual,
"When a procedure...is called, the actual parameters are copiend ito the
formal parameters... On exit,...formal are copied back to actual if they
are not expressions or constants."
This is, at best, a feeble attempt to describe pass by reference. The
parameters are not copied, they are referenced (try passing an array so
large that copying would use up all memory -- you can do it, ergo no
copying happened).
Time for a rewrite, RSI!
Peter
--------------------------------
Peter Webb, HP Labs Medical Dept
E-Mail: peter_webb@hpl.hp.com
Phone: (415) 813-3756
|
|
|
|