🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

G++ doesn't like struct's called main

#1490
From: "Douglas C. Schmidt"
Date: Tue, 11 Oct 1988 04:35
36 lines
1541 bytes
Hi,

  I'm not sure if this is a bug or a feature, but g++ 1.27 doesn't
like struct's (or classes) called ``main.''  The code below gets a
parse error from 1.27.  It compiles and executes ``correctly'' using
AT&T CC 1.2.1 and gcc 1.28.

----------------------------------------
struct main {
   int foo;
};

struct main Init_Code;

main() {
   printf ( "hello world\n" );
}
----------------------------------------

Here are the diagnostics:

----------------------------------------
g++ version 1.27.0
 echo use .cc filename extension!
use .cc filename extension!
 /usr/public/lib/g++/gcc-cpp+ -v -I/cd/ua/schmidt/include/ -undef -D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix -+ test.c /tmp/cca00108.cpp
GNU CPP version 1.27.0
 /usr/public/lib/g++/gcc-c++ /tmp/cca00108.cpp -quiet -dumpbase test.c -fchar-charconst -version -o /tmp/cca00108.s
test.c:7: parse error before `{'
test.c:7: cannot open file parse.output
GNU C++ version 1.27.0 (sparc) compiled by GNU C version 1.28.
State is 256, input token number is 123.
----------------------------------------

Doug
Technical Details
Message-ID: <8810102135.aa09665@PARIS.ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%blanche.ics.uci.edu

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%blanche.ics.uci.edu
From: schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt")
Newsgroups: gnu.g++.bug
Subject: G++ doesn't like struct's called main
Message-ID: <8810102135.aa09665@PARIS.ICS.UCI.EDU>
Date: 11 Oct 88 04:35:18 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 36