[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pointer to structures
- Subject: Re: pointer to structures
- From: "J.D. Smith" <jdsmith(at)astro.cornell.edu>
- Date: Tue, 04 Apr 2000 18:21:33 -0400
- Newsgroups: comp.lang.idl-pvwave
- Organization: Cornell University
- References: <8cd1er$2pp$1@nnrp1.deja.com> <38EA0FF6.20C0A098@ssec.wisc.edu> <38EA17DA.F3D9E54@astro.cornell.edu> <38EA533B.525341FB@ssec.wisc.edu>
- Sender: verified_for_usenet(at)cornell.edu (jts11 on vodka.tn.cornell.edu)
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:19130
"Liam E.Gumley" wrote:
>
> "J.D. Smith" wrote:
> > 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)
>
> I neglected to provide an example of why simplified pointer and
> structure referencing is desirable. Thanks for the help JD!
>
> ;-)
>
> Cheers,
> Liam.
But then you have to ask yourself which is worse, the confusing string above, or
the explicit:
drs_ptr=self.DR
drs=*drs_ptr
this=drs[sel[i]]
hd_arr_ptr=*this
hd=*hd_arr_ptr
repeat this about 5000 times throughout your application, and you begin to
appreciate the terse form above. Especially if you're passing some part of the
nested data to a routine by reference... intermediate variables require you to
remember to assign them after use (everybody remember
widget_control,stash,set_uvalue=state,/NO_COPY?).
Maybe we need a lexical parser like cdecl, to check on these for you? A fine
programming project for an aspiring IDL programmer out there.
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 |*|