🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1761

anonymous non-bit-field fields

#1761
From: Ron Guilmette
Date: Sun, 19 Mar 1989 21:31
26 lines
1333 bytes
(I am cross posting this to bug-gcc and bug-g++ since it seems to affect
both compilers).

I just now learned about "unnamed" structure fields.  Somebody on the
net mentioned them so I looked them up in my December 7, 1988 ANSI-C
draft standard.

I like the idea, but the ANSI syntax requires that unnamed fields can only
be bit-fields, not normal fields!  It would make more sense to me allow either,
but that's ANSI for you!

Anyway, GCC (1.33) and G++ (1.34.1) allow either, but even when the
-pedantic switch is used, neither compiler generates an error or warning
when unnamed field are non-bit-fields, as in the example below:

struct s {
	int a;
	int ;		/* ERROR: unnamed field is not a bit field */
	int b;
};

// Ron Guilmette  -  MCC  -  Experimental (parallel) Systems Kit Project
// 3500 West Balcones Center Drive,  Austin, TX  78759  -  (512)338-3740
// ARPA: rfg@mcc.com
// UUCP: {rutgers,uunet,gatech,ames,pyramid}!cs.utexas.edu!pp!rfg
Technical Details
Message-ID: <8903192131.AA15559@riunite.aca.mcc.com>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!MCC.COM!rfg

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!MCC.COM!rfg
From: rfg@MCC.COM (Ron Guilmette)
Newsgroups: gnu.g++.bug
Subject: anonymous non-bit-field fields
Message-ID: <8903192131.AA15559@riunite.aca.mcc.com>
Date: 19 Mar 89 21:31:37 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 26