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

Home » Public Forums » archive » Re: 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: pointer question [message #24283 is a reply to message #24276] Sun, 25 March 2001 14:16 Go to previous messageGo to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Pavel A. Romashkin" <pavel.romashkin@noaa.gov> wrote in message
news:3ABA272F.538D0EB0@noaa.gov...
> Mark Hadfield wrote:
>
>> pro test, a
>>
>> ; Do something with a
>>
>> if not arg_present(a) then if ptr_valid(a) then ptr_free, a
>>
>> end
>
> I am sorry, I have not had my first cup of coffe yet. How is that
> supposed to work? If there is *no* argument present, *then* try to check
> if the missing argument is a pointer? What am I missing?

The question answered by ARG_PRESENT is not "Is this argument present", it
is "If I change this variable, will it be passed back to the caller?". So
the intention of the code in routine "test" was to see whether the calling
program holds a reference to variable a.

I have never used this in my own code, but tt seemed like a clever idea when
I suggested it. Jaco has pointed out the flaw: what if the caller holds the
pointer heap variable (say in an array) but chooses to pass it by value?

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: widget fonts
Next Topic: *.cdf files

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

Current Time: Sat Oct 11 09:41:33 PDT 2025

Total time taken to generate the page: 1.20000 seconds