🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2502

variable length arrays broken?

#2502
From: "Douglas C. Schmidt"
Date: Tue, 04 Apr 1989 03:55
34 lines
1076 bytes
The following is an example from the gcc.texinfo file:

----------------------------------------
int foo;

struct entry
{
  char data[foo];
};

struct entry
tester (struct entry arg)
{
  struct entry new;
  int i;
  for (i = 0; i < foo; i++)
    new.data[i] = arg.data[i] + 1;
  return new;
}
----------------------------------------

This does not compile with gcc 1.34, however.  The compiler
complains that:

----------------------------------------
test.c:5: variable-size type declared outside of any function
----------------------------------------

Is the documentation out-of-date, or is the compiler wrong?

thanks,

Doug
Technical Details
Message-ID: <8904032055.aa00525@PARIS.ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!GLACIER.ICS.UCI.EDU!schmidt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!GLACIER.ICS.UCI.EDU!schmidt
From: schmidt@GLACIER.ICS.UCI.EDU ("Douglas C. Schmidt")
Newsgroups: gnu.gcc.bug
Subject: variable length arrays broken?
Message-ID: <8904032055.aa00525@PARIS.ICS.UCI.EDU>
Date: 4 Apr 89 03:55:49 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 34