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

Home » Public Forums » archive » Pointer Problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Pointer Problem [message #9577] Mon, 14 July 1997 00:00
J.D. Smith is currently offline  J.D. Smith
Messages: 214
Registered: August 1996
Senior Member
This is a possible pointer problem which may affect some of you. See
what you think about the following code:

IDL> a=ptr_new()
IDL> print,ptr_valid(a)
0
IDL> help,*a
% Unable to dereference NULL pointer: A.
% Execution halted at: $MAIN$
IDL> b=ptr_new(notavalidvariable)
IDL> help,b
B POINTER = <PtrHeapVar2>
IDL> print,ptr_valid(b)
1
IDL> help,*b
<PtrHeapVar2> UNDEFINED = <Undefined>
IDL> print,*b
% PRINT: Variable is undefined: <PtrHeapVar2>.
% Execution halted at: $MAIN$


Note here that 'notavalidvariable' is a fake, undefined variable. B is
assigned to an undefined heap variable, as if /ALLOCATE_HEAP had been
specified. Consequently, ptr_valid see's b as valid. This behavior is
mildly irksome in that the convenience of assigning pointers without
checking the contents of that which they are being assigned to is lost.
It is also non-intuitive.

JD
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Obj_Isa bug
Next Topic: Bitmaps

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

Current Time: Wed Oct 08 19:32:44 PDT 2025

Total time taken to generate the page: 0.00535 seconds