comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Programming style
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Programming style [message #3369] Thu, 19 January 1995 04:30
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
In article <3fjcbe$2el@due.uninett.no>, lars@rapid.fi.uib.no (Lars
S�raas) writes:
|>
|> Does anybody out there know if IDL passes arguments to functions by
|> value
|> or by refrence? I have developed a programming-style where I tend to
|> pass huge
|> datastructures as parameters and not through common blocks. This is
|> obviously inefficient in the pass-by-value-case, so I might have to
|> change
|> my style.
|>

As a general rule, IDL passes arguments by reference. The only (partial)
exception is when you pass a subset of an array, e.g:

MYPROG,DATA(0:10,*)
; or
MYPROG,DATA(1)

In this case, IDL generates a new "variable" (or rather an expression)
with values taken from the original array (this may involve a lot of
memory shoveling), and passes it to the routine by reference. I.e., the
receiving routine is not able to change the values in the original array
by altering elements in the sub-array that it receives. This is important,
because e.g., READ,DATA(0) doesn't work.

Personally, I agree totally with your programming style - I'm much
happier with passing parameters than using common blocks, even if
there's a slight overhead in sending the reference.

Stein Vidar Haugan
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: RANDOMU bug?
Next Topic: IDL FAQ

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:34:31 PDT 2025

Total time taken to generate the page: 0.00588 seconds