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

Home » Public Forums » archive » Newbie Questions
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: Newbie Questions [message #25091 is a reply to message #25039] Fri, 18 May 2001 04:25 Go to previous message
Alex Schuster is currently offline  Alex Schuster
Messages: 124
Registered: February 1997
Senior Member
Geoff Herbynchuk wrote:

> And, if we do:
>
> bar_ptr = ptr_new(bar, /no_copy)
>
> bar_ptr will now just point to the memory location where bar is stored
> (not copy it to a heap location)? We can then update the bar, or the
> components of bar(if bar is a structure) by dereferencing bar_ptr,
> right?

Wrong :( With /no_copy, bar becomes undefined, because its value is
taken away and being attached directly to bar_ptr.


> For example:
>
> *bar_ptr.name = 'Geoff'

Caution, this would be (*bar_ptr).name, because bar_ptr is the pointer,
not bar_ptr.name.


> Thanks for everyone's help. I've only worked with pointers in
> C/C++ before, and I'm getting the impression that these don't work
> exactly the same way. =)

Correct. In C, they are real pointers to a memory location. In IDL, they
are just a heap variable. Tricks like p=&a, *p=5 to set a to 5 will not
work in IDL.
You can, however, set bar2_ptr = bar_ptr, and now at least these two
point to the same value, and *bar2_ptr = 0 also sets *bar_ptr to 0.

Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de
[Message index]
 
Read Message
Read Message
Previous Topic: Re: only valid numbers in arrays
Next Topic: color table conversion

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

Current Time: Wed Oct 15 02:02:01 PDT 2025

Total time taken to generate the page: 3.03701 seconds