🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Initializer

#284
From: Michael T Pope
Date: Tue, 18 Jul 1989 06:13
31 lines
1588 bytes
(G++/Gcc 1.35, Sun 4, SunOS 3.x)
G++ accepts the following without complaint--- should it?
Gcc is less forgiving.

------------------------------
#include <stdio.h>

const int b = 1;
const int a = b * a; // ERROR?

void main() {
  fprintf(stderr, "%d\n", a);
}
------------------------------

% g++ -v -o foo foo.c
g++ version 1.35.0
 /usr/local/gnu/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ foo.c /tmp/cca24594.cpp
GNU CPP version 1.35
 /usr/local/gnu/gcc-cc1plus /tmp/cca24594.cpp -quiet -dumpbase foo.c -noreg -version -o /tmp/cca24594.s
GNU C++ version 1.35.0 (sparc) compiled by GNU C version 1.35.
 as /tmp/cca24594.s -o foo.o
 /usr/local/gnu/gcc-ld++ -o foo -C /usr/local/gnu/crt0+.o foo.o -lg++ /usr/local/gnu/gcc-gnulib -lc
% gcc -v -o foo foo.c
gcc version 1.35
 /usr/local/gnu/gcc-cpp -v -undef -D__GNUC__ -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ foo.c /tmp/cca24578.cpp
GNU CPP version 1.35
 /usr/local/gnu/gcc-cc1 /tmp/cca24578.cpp -quiet -dumpbase foo.c -version -o /tmp/cca24578.s
GNU C version 1.35 (sparc) compiled by GNU C version 1.35.
foo.c:4: initializer for static variable is not constant
% 
Technical Details
Message-ID: <8907171446.12707@munnari.oz.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!augean.oz.au!mpope

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!augean.oz.au!mpope
From: mpope@augean.oz.au (Michael T Pope)
Newsgroups: gnu.g++.bug
Subject: Initializer
Message-ID: <8907171446.12707@munnari.oz.au>
Date: 18 Jul 89 06:13:37 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 31