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

Home » Public Forums » archive » Re: update variable in structure
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: update variable in structure [message #66951 is a reply to message #66950] Tue, 16 June 2009 09:14 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
M. Suklitsch writes:

> So far, so good. Now we do exactly the same, but this time the
> variable is embedded in a structure:
> IDL> my_struct = {my_value:8}
> IDL> update_value, my_value
> IDL> help, my_struct, /STRUC
> ** Structure <8220044>, 1 tags, length=2, data length=2, refs=1:
> MY_VALUE INT 8
>
> And now the rather simple question: how come this doesn't work?

I think you must have meant, why doesn't *this*
work:

IDL> udate_value, my_struck.my_value

And the reason is that structure dereferences, like
expressions, array subscripts, etc., etc. (in fact,
anything *except* a variable) are passed by *value*
and not by *reference*. Things that are passed by
value make a copy of themselves and pass that, rather
than passing the thing itself.

Cheers,

David

--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: POLAR_CONTOUR plot giving strange values for contour lines
Next Topic: Trial version of Slither, the IDL to Python bridge, available

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

Current Time: Sat Oct 11 16:01:59 PDT 2025

Total time taken to generate the page: 0.64072 seconds