🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1371

Re: structs that define nothing

#1371
From: Donald W. Rouse II
Date: Wed, 27 Jan 1993 17:33
34 lines
1383 bytes
In article <1993Jan25.171222.1@fnalng.fnal.gov> b91926@fnalng.fnal.gov writes:
>Does the c++ standard have anything to say about the legality of a
>construct like the following:
>
>...
>struct
>{
>  int a;
>  int b;
>};
>
>...
>
>Such an example appeared in a recent issue of "C++ Report". The
>problem with this code is that it defines absolutely nothing.

This example reminds me of a possible extension to C++ (and C)
that could occasionally be useful: anonymous structures,
which are analogous to anonymous unions.

Example:
	typedef union
		{
		unsigned long lw;
		struct { unsigned short sw0, sw1; };
		struct { unsigned char b0, b1, b2, b3; };
		}	machword;
	machword	r1, r2;

Now you can access r1.b2, instead of having to do
something like r1.b.b2, etc.

Note that the only place this would be useful
is inside a union.
Technical Details
Message-ID: <1993Jan27.173319.15550@cci632.cci.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.eng.gtefsd.com!emory!swrinde!sdd.hp.com!usc!howland.reston.ans.net!bogus.sura.net!darwin.sura.net!ukma!cs.widener.edu!dsinc!ub!galileo.cc.rochester.edu!rochester!rit!cci632!dwr
References: <1993Jan25.171222.1@fnalng.fnal.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.eng.gtefsd.com!emory!swrinde!sdd.hp.com!usc!howland.reston.ans.net!bogus.sura.net!darwin.sura.net!ukma!cs.widener.edu!dsinc!ub!galileo.cc.rochester.edu!rochester!rit!cci632!dwr
From: dwr@cci632.cci.com (Donald W. Rouse II)
Newsgroups: comp.std.c++
Subject: Re: structs that define nothing
Message-ID: <1993Jan27.173319.15550@cci632.cci.com>
Date: 27 Jan 93 17:33:19 GMT
References: <1993Jan25.171222.1@fnalng.fnal.gov>
Organization: [Computer Consoles, Inc., Rochester, NY
Lines: 34