Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!decvax!mcnc!gatech!udel!rochester!PT.CS.CMU.EDU!IUS1.CS.CMU.EDU!edw From: edw@IUS1.CS.CMU.EDU (Eddie Wyatt) Newsgroups: comp.lang.c Subject: Re: Conformant Arrays in C Message-ID: <996@PT.CS.CMU.EDU> Date: 29 Feb 88 15:00:29 GMT References: <42529@sun.uucp> <7297@brl-smoke.ARPA> <676@cresswell.quintus.UUCP> <708@cresswell.quintus.UUCP> Sender: netnews@PT.CS.CMU.EDU Organization: Carnegie-Mellon University, CS/RI Lines: 34 Keywords: ANSI C, C++ In article <708@cresswell.quintus.UUCP>, ok@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@ius1.cs.cmu.edu