🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Michael T Pope Tue, 18 Jul 1989 06:13
Initializer
#284
Author: 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
% 
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