🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Bug with variable-length arrays in argument list

#332
From: Robert Kennedy
Date: Fri, 04 Aug 1989 21:28
46 lines
1564 bytes
Running version 1.35.1- on a Sun 4/110, SunOS:
Variable length arrays as described on page 46 of the manual are
broken.

----------------- begin c++ program ---------------------
#include <stream.h>

void gripe(int a, char c[a])

{
cout << c[0];
}


main()

{
gripe(2, "T");
}
----------------- begin g++ output ---------------------
winge.cc:3: `a' undeclared, outside of functions
winge.cc:5: parameter `c' has incomplete type
In function void gripe (int, _0):
winge.cc:6: `c' was not declared (first use this function)
winge.cc:6: (Each undeclared identifier is reported only once
winge.cc:6: for each function it appears in.)
In function int main ():
winge.cc:13: parameter type of called function is incomplete
------------------------ end g++ output ---------------------

Note also that the following program should compile and work in the
obvious way (but doesn't -- compiler output excluded for brevity):

#include <stream.h>

void multiwinge(int a, char c[][a])

{
cout << c[1][0];
}

main()

{
multiwinge(2, "Should print u");
}
Technical Details
Message-ID: <CMM.0.88.618269303.robert@Polya.Stanford.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!POLYA.STANFORD.EDU!robert

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!POLYA.STANFORD.EDU!robert
From: robert@POLYA.STANFORD.EDU (Robert Kennedy)
Newsgroups: gnu.g++.bug
Subject: Bug with variable-length arrays in argument list
Message-ID: <CMM.0.88.618269303.robert@Polya.Stanford.EDU>
Date: 4 Aug 89 21:28:23 GMT
Sender: kathy@tut.cis.ohio-state.edu
Reply-To: Robert Kennedy <robert@polya.stanford.edu>
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 46