🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c++
Article #207

bug

#207
From: Bjarne Stroustrup
Date: Sat, 24 May 1986 13:29
29 lines
1433 bytes
cit-vax.Caltech.Edu (Jonathan P. Leech)
>
>    The following code:
> 
> 	int spam() {
> 	    double (*z)[4] = (double (*)[4])0;
> 	}
> 
>     is legal C code. It is not legal C++ code (release 1.0),
> generating the following error message:
> 
>     "junk.c", line 2: error:  z is undefined
> 
>     Declarations of this form seem not to cause any problem in member
> functions of classes (the only other context in which I had occasion
> to use them in C++ until tonight). This is a most annoying bug. Any
> help in fixes or workarounds would greatly appreciated.

Yes that is a nasty cfront bug. Sorry. The code is legal C++ but I have
persistent problems convincing YACC about that.

Fortunately the workaround is simple:

	int spam() {
 	    auto double (*z)[4] = (double (*)[4])0;
	}

In general, if you get funny error messages in connection with pointer to
function declarations use a storage class specifier to help YACC.
Technical Details
Message-ID: <5519@alice.uUCp>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!alice!bs

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!alice!bs
From: bs@alice.UucP (Bjarne Stroustrup)
Newsgroups: net.lang.c++
Subject: bug
Message-ID: <5519@alice.uUCp>
Date: Sat, 24-May-86 09:29:16 EDT
Article-I.D.: alice.5519
Posted: Sat May 24 09:29:16 1986
Date-Received: Sun, 25-May-86 18:29:22 EDT
Organization: Bell Labs, Murray Hill
Lines: 29