Conformant Arrays in C

Eddie Wyatt edw at IUS1.CS.CMU.EDU
Tue Mar 1 01:00:29 AEST 1988


In article <708 at cresswell.quintus.UUCP>, ok at quintus.UUCP (Richard A. O'Keefe) writes:
> 
> 4.  Untagged unions.
> 
>     Not only does C++ have C's unions, it goes out of its way to make
>     it easier to trip over your own feet.  I refer to anonymous unions.
> 
>     I could write a hymn of praise to tagged unions, discrimination
>     case statements, and polymorphic types, and an execration text
>     for untagged unions, but let's keep it down.
> 

 There are tradeoffs in requiring or not requiring tag fields.  It's
the space vs readablity problem again.   In the system that I maintain,
I use indiscriminate unions for space and time reasons.  I use arrays of
indiscriminate unions (TOKENs) to basically represent C structures.  There
are a number of fields predefined by the system for systems use.  One
of these fields is an index into a table that discribes the structure
of the TOKEN.  So the tag fields of the union can be view as external
to the union that they are associated with in my example.   This
save a lot of space.  Time savings comes into play when transferring
these guys over the network.  I only transfer the data object, and
no tag field information.  Again tables  are used to discriminate
the object coming across the net.

BTW I not gunning for you Rich.  I know that I some of my posts may seem to 
be attacking your views.  They really are not, I'm just adding my .02 
to the discussion.  And I have to say, I agree with a lot of your posts.

(P.S. I think I have to get out my differential geometry notes and 
review tensor :-))
-- 

Eddie Wyatt 				e-mail: edw at ius1.cs.cmu.edu



More information about the Comp.lang.c mailing list