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

Home » Public Forums » archive » Re: Naive pointer question ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Naive pointer question ? [message #28922] Wed, 23 January 2002 08:02 Go to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
trouble wrote:

> From my understanding, pointers are useful in C where you have the
> option of passing by value or by reference, but in IDL it seems one
> *always* passes by reference (insofar as any variable passed to a
> function and then changed within that function is also changed in the
> calling function).

IDL does NOT always pass by reference. It passes expressions, constants,
and system variables by value. For constants, that's quite reasonable.
However, for system variables that are writeable, it means that they
can't be updated by reference, but only by explicitly assigning them.

Also, subscripted arrays and references to fields of a structure count
as expressions, and hence are not passed by reference, a fact that
surprised me the first time I got bit by it. From my C background, I
expected to be able to pass structure.array_member to a function, and
have that function be able to update elements of that array_member. I
also expected to be able to pass array(0,*) to a function, and have that
function be able to update array(0,2). I understand now why that doesn't
work; I'm just saying that it's not what I expected.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: runtime-license
Next Topic: bug in curvefit?

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

Current Time: Wed Oct 08 15:52:02 PDT 2025

Total time taken to generate the page: 0.00418 seconds