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

Home » Public Forums » archive » Re: pointer to structures
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 to structures [message #19564 is a reply to message #19558] Tue, 04 April 2000 00:00 Go to previous messageGo to previous message
John-David T. Smith is currently offline  John-David T. Smith
Messages: 384
Registered: January 2000
Senior Member
"Liam E.Gumley" wrote:
>
> eeeyler@my-deja.com wrote:
>> suppose I wish to create a structure and wish to reference that
>> structure and its contents via a pointer:
>> filter=ptr_new({points:['a','b'],pt1_value:200, pt2_value:'X_WHYLOG'})
>> how do I reference the points array? I thought it would be as:
>> print, *filter.points
>> but I get the message
>> %Expression must be a structure in this context: Filter
>
> ptr = ptr_new({test:indgen(10)})
> print, (*ptr).test
> 0 1 2 3 4 5 6 7
> 8 9
>
> If you want to keep it really simple and clean, separate the pointer
> de-reference and the structure reference:
>
> struct = *ptr
> print, struct.test
>
> This can make your code much more understandable when multiple levels of
> de-referencing are required (say if the structure contains a pointer to
> an array).

With time, you will get used to these semantics. They seem arcane, but
eventually it becomes somewhat readable to the experienced eye. Of course, I've
struggled with statements like:

HEADER=*(*(*self.DR)[sel[i]].HEADER)

but you eventually get the hang of it.

JD

--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-6263
304 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
[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
Previous Topic: Re: get variables name
Next Topic: Re: Speed up movie in object graphics.

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

Current Time: Wed Oct 08 20:05:37 PDT 2025

Total time taken to generate the page: 0.00895 seconds