Need help with union trick: summary of replies

Doug Gwyn gwyn at smoke.brl.mil
Sun Jan 13 13:29:47 AEST 1991


In article <1991Jan12.190021.16071 at nntp-server.caltech.edu> gceych at 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.



More information about the Comp.lang.c mailing list