[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: IDL 5 Syntax ?
- Subject: Re: IDL 5 Syntax ?
- From: davidf(at)dfanning.com (David Fanning)
- Date: Tue, 17 Aug 1999 18:17:18 -0600
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- References: <37B9E944.16A338E1@ngdc.noaa.gov>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:16161
Eric Kihn (eak@ngdc.noaa.gov) writes:
> I have a syntax question regarding IDL objects. I have a object
> which has as one of it's data elements
> a pointer to a structure (data). In a method (draw) if I try to
> access part of the structure like:
>
> plot, *self.data.X
>
> I get the dread "Must be a structure in this context" message. (Which
>
> I think it is)
> Where as if I do a :
> ds = *self.data
>
> Plot,ds.X
>
> Everypne is happy. Why?
Because the pointer dereference has the lowest order
of precedence. Lower, even, than a structure dereference.
So in the code that doesn't work, the data structure is
dereferenced first, and then the pointer is dereferenced.
But the pointer dereference is not dereferencing a pointer
at that point, so this syntax fails.
What you can do (in all of IDL) is put parentheses
around something that you want to have a higher order
of precedence, since parentheses have the highest order
precedence. This will work:
Plot, (*self.data).x
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155