🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Dave Hanson Sat, 08 Oct 1988 13:38
linkage warnings
#1883
Author: Dave Hanson
Date: Sat, 08 Oct 1988 13:38
38 lines
1533 bytes
after much reading of the 5/88 standard and K&R2, and discussions
with others here and at bell labs,
i think the convoluted explanations of linkage boil
down to ``first declaration determines linkage''.
thus, the following program specifies inconsistent
linkage for both f and g.

[709] cat bug4.c
extern int f();
int g();

static f() {}
static g() {}

gcc doesn't complain:

[710] gcc -v -S bug4.c
gcc version 1.28
 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dvax -Dunix bug4.c /tmp/cc028903.cpp
GNU CPP version 1.28
 /usr/local/lib/gcc-cc1 /tmp/cc028903.cpp -quiet -dumpbase bug4.c -version -o bug4.s
GNU C version 1.28 (vax) compiled by GNU C version 1.28.

it should ellicit at least a warning, e.g.

[711] lcc -S bug4.c
bug4.c:4.12:f(): warning: inconsistent linkage for f
bug4.c:5.12:g(): warning: inconsistent linkage for g

i note that gcc does warn about other linkage errors, e.g.

f() { extern int x;}
static int x;

draws

At top level:
bug3.c:2: warning: `x' was declared `extern' and later `static'
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