🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Douglas C. Schmidt" Tue, 11 Oct 1988 04:35
G++ doesn't like struct's called main
#1490
Author: "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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads