[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conflicting Data structures



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