Path: utzoo!attcan!uunet!samsung!uakari.primate.wisc.edu!unmvax!pprg.unm.edu!topgun!mustang!nntp-server.caltech.edu!juliet.caltech.edu!gceych From: gceych@juliet.caltech.edu (Eychaner, Glenn C.) Newsgroups: comp.lang.c Subject: Re: Need help with union trick: summary of replies Message-ID: <1991Jan13.072418.1745@nntp-server.caltech.edu> Date: 13 Jan 91 06:11:03 GMT References: <28949@mimsy.umd.edu> <2885@cirrusl.UUCP> <1991Jan12.190021.16071@nntp-server.caltech.edu> <14836@smoke.brl.mil> Sender: news@nntp-server.caltech.edu Reply-To: gceych@juliet.caltech.edu Organization: California Institute of Technology Lines: 37 News-Software: VAX/VMS VNEWS 1.3-4x Nntp-Posting-Host: juliet.caltech.edu In article <14836@smoke.brl.mil>, gwyn@smoke.brl.mil (Doug Gwyn) writes... >In article <1991Jan12.190021.16071@nntp-server.caltech.edu> gceych@juliet.caltech.edu writes: >- struct { >- variant_union { >- unsigned char ch; >- variant_struct { >- unsigned one : 1; >- unsigned two : 1; >- ... >- unsigned eig : 1; >- } superfluous; >- } superfluous2; >- int i, j, k, x, y, z; >- } mystructure; > >Oh, gross. If you use this highly nonstandard VMS C extension then >you'll have to overhaul your code when you port it to a different >environment. It is much better to simply not use such unnecessary >vendor-specific extensions in the first place. The piece of code of which this is a small part contains so many system calls, kludges, etc. that portability is not a major concern. In fact, it was written for a VAX station bought to eventually replace an 11/44. At that rate of replacement, the language will be obsolete before the code is. (The programs on the 11/44 were written in an early Fortran. Gross. Which is just what they'll think of VaxC by the time the programming needs to be ported.) Besides, I happen to LIKE this particular construct for nested structures and unions (as an option). I hate remembering the names of all the intermediates. Especially when the variables are all going to have different names anyway. Direct flames to bit.bucket, please. Glenn C. Eychaner | "We demand rigidly defined areas of doubt and uncertainty." 40386 N. Shore Ln `-----. -D. Adams Big Bear City, CA 92314 `-----------------------. !**** G O N I N E R S ****! Eychaner%SunCub.Caltech.edu@Xhmeia.Caltech.edu -|- Big Bear Solar Observatory