[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Conflicting Data structures
- Subject: Re: Conflicting Data structures
- From: davidf(at)dfanning.com (David Fanning)
- Date: Tue, 29 Jun 1999 14:04:38 -0600
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- References: <7l5uvi$in8$1@news.doit.wisc.edu> <37778EB0.2CE6EEAA@acsys.it> <7lb6ed$p2k$1@nnrp1.deja.com>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:15457
Dirk (dfabian@my-deja.com) writes:
> This was it! I had defined the structure with a
> name (i'm not sure why) and somehow that caused
> the conflict. Can anyone tell me what the purpose
> of having a named structure versus an anonymous
> structure might be?
Named structures are much easier to use sometimes, since
the *definition* of the structure is stored inside of
IDL. So, if I make a structure like this:
a = {EMPLOYEE, name:'', age:0, salary:0.0}
Then, I can get one of those "things" named
EMPLOYEE like this:
b = {EMPLOYEE}
And IDL knows that b is that kind of a structure with
three fields, name, age, and salary and it knows how
those fields are defined. I don't have to reproduce
this information each time I make another EMPLOYEE
structure.
In general, use named structures for structures whose
fields are not likely to ever change. Use anonymous
structures for all the rest.
> It doesn't seem like the
> named structures are as versatile - you certainly
> can't destroy them and re-fill them with new
> information.
Anything that will be changing inside of a structure
should be implemented with a pointer, regardless of
whether you are using Named or Anonymous structures.
If done this way, "re-filling" them is not difficult
at all.
> Sometimes.. i just want to pinch IDL.
Humm. I don't think we want to bring up this subject
in *this* group. Please take this over to alt.comp.fetish. :-(
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