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

Home » Public Forums » archive » Re: structures, arrays of pointers and assignment
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: structures, arrays of pointers and assignment [message #53750 is a reply to message #53747] Wed, 02 May 2007 06:47 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ingo von Borstel writes:

> Any clue as to why? My guess it's to do with passing elements of a
> struct prohibits its modification by a subroutine.

I think you already know the answer. When you pass a de-referenced
structure variable, you pass it by value, and when you pass
the structure itself, you pass it by reference. When something
is passed by value, a copy of the thing is made and worked on.
There is no possibility of affecting the original.

> If so, is there a way to circumvent this behaviour?

If you mean circumvent this behavior within the confines
of pass by value or pass by reference, the answer is no.
But this is software. Anything is possible! You could,
for example, have your program return a value that you then
assigned to the proper field in the structure. But the
easiest thing to do, of course, since you have the
structure hanging around or you wouldn't be able to pass
a *field* of the structure, is to just pass the whole darn
thing. That seems simple enough to me.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://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: HISTOGRAM and string data
Next Topic: Re: ENVI does a dumb thing reading a TIFF file with a palette included

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

Current Time: Thu Oct 09 20:42:10 PDT 2025

Total time taken to generate the page: 0.87687 seconds