roger@procase.UUCP (Roger H. Scott) (06/01/90)
Okay all you language lawyer types, here's a fun one for you.
Which, if any, of the following are legal? Which, if any, should be?
Why?
typedef unsigned GlobalBit : 1;
GlobalBit ASingleBit;
GlobalBit AnArrayOfBits[6]; // shave and a hair cut, ...
struct {
GlobalBit aBitMember;
GlobalBit anArrayOfBitsMember[6];
} AStructContainingVariousGlobalBits;
struct {
typedef unsigned StructBit : 1;
StructBit aBitMember;
StructBit anArrayOfBitsMember[6];
} AStructContainingVariousStructBits;
If you like fireworks try feeding this stuff to cfront. I'd be curious to
hear what g++'s reaction to this code is.kells@iis.UUCP (Kevin Kells) (06/03/90)
In article <157@logo.procase.UUCP> roger@procase.UUCP (Roger H. Scott) writes: >I'd be curious to hear what g++'s reaction to this code is. g++ 1.37.1 crashes with a fatal signal at the point where it hits > typedef unsigned StructBit : 1; in code similar to the code posted by Roger S., at least on our Sun3, Sun4, Symmetry, and Convex. I posted the bug to gnu.g++.bug in case anyone wanted to do the same. Kevin -- Kevin D. Kells Real-mail: Institut fuer Integrierte Systeme uucp: kells@iis.UUCP ETH-Zentrum Internet: kells@iis.ethz.ch CH-8092 Zuerich Phone alternate: kdk@prism.gatech.edu Switzerland +41-1-256-5746
rfg@ics.uci.edu (Ronald Guilmette) (06/04/90)
In article <157@logo.procase.UUCP> roger@procase.UUCP (Roger H. Scott) writes: >Okay all you language lawyer types, here's a fun one for you. >Which, if any, of the following are legal? Which, if any, should be? >Why? > > typedef unsigned GlobalBit : 1; This is illegal in ANSI-C and (by implication) also illegal in C++. All of your subsequent uses of the typename GlobalBit are also illegal because the typename itself was improperly declared. // Ron Guilmette (rfg@ics.uci.edu) // C++ Entomologist // Motto: If it sticks, force it. If it breaks, it needed replacing anyway.
ark@alice.UUCP (Andrew Koenig) (06/04/90)
In article <157@logo.procase.UUCP>, roger@procase.UUCP (Roger H. Scott) writes: > Okay all you language lawyer types, here's a fun one for you. > Which, if any, of the following are legal? Which, if any, should be? > Why? > typedef unsigned GlobalBit : 1; This isn't legal C and shouldn't be legal C++. That renders all the following examples illegal too. Cfront naively accepts it; thanks for pointing it out. -- --Andrew Koenig ark@europa.att.com
roger@procase.UUCP (Roger H. Scott) (06/08/90)
In article <10896@alice.UUCP> ark@alice.UUCP (Andrew Koenig) writes: >In article <157@logo.procase.UUCP>, roger@procase.UUCP (Roger H. Scott) writes: > >> typedef unsigned GlobalBit : 1; > >This isn't legal C and shouldn't be legal C++. >That renders all the following examples illegal too. I don't doubt that the global case is/should be illegal. How so does it rended the class-scope cases illegal? What is the reasoning there? @ @ @ @ @ @ @ @ @ @ @