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

Home » Public Forums » archive » Re: Creating pointer 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: Creating pointer in structure [message #27745 is a reply to message #27737] Thu, 01 November 2001 08:56 Go to previous messageGo to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
I use both ways, but I prefer /ALLOCATE. The /ALLOCATE is very
convenient when you know your pointer must be defined, and it saves time
when the pointer is filled later. I sometimes do not allocate heap if
the pointer may not be required (like a UVALUE property of an object,
for example). I rarely check on validity of pointers because I make my
code issue an error earlier, at the INIT stage, if a vital pointer is
not filled with necessary data, so Paul's remark does not really apply
in my case. For writing object methods, having valid pointers makes it a
lot easier, especially if a field is changeable by several methods.

Cheers,
Pavel

"K. Bowman" wrote:
>
> If I need to define a structure containing a pointer before I know the
> characteristics of the associated heap variable, which of the following
> is preferable? Does it make any difference, or is it simply a matter
> of programming taste?
>
> For example:
>
> a = {point: PTR_NEW()} ;Create struct w/ null pointer
> ... figure out what n is
> a.point = PTR_NEW(FINDGEN(n)) ;Replace null pointer
>
> or
>
> b = {point: PTR_NEW(/ALLOCATE_HEAP)} ;Create struct w/ pointer->undef
> ... figure out what n is
> *b.point = FINDGEN(n) ;Define heap var
>
> Thanks, Ken
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: gif license
Next Topic: Re: DLM problem when returning an array of structures ...

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

Current Time: Fri Oct 10 03:41:55 PDT 2025

Total time taken to generate the page: 1.03750 seconds