On Tue, 9 Sep 2003 21:57:23 +0200, Matthieu Herrb wrote: >Thomas Dickey wrote (in a message from Tuesday 9) > > On Tue, 9 Sep 2003, Warren Turkal wrote: > > > -#if NeedFunctionPrototypes > > > -extern void scale_init(void); > > > -extern char *nscale(int, int, int, char *); > > > > while I'm perfectly aware that "extern" is redundant, there are two > > things to be said in favor of keeping it: > > > > a) it's easy to grep for > > > > b) some compilers silently ignore conflicts with a "static" definition of > > the prototype, but can be persuaded to warn if the extern is explicit. > > (gcc does this, making it unsuitable as the only compiler to use for > > testing). > >... and a 3rd reason is that 'extern' is not optional for >variables.
Wrong. >Most traditional Unix linkers will allow the same variable >to be declared without 'extern' in multiple object files and merge >them into only one, but this behaviour is not a feature one should >rely on. And it fact, at least the Darwin linker treats this as an >error. If so, then the Darwin linker is defective. ISO Standard C variables do NOT require the "extern" modifier in order to have external linkage. A variable at file scope without an initializer is automatically "extern". <<<file_1.c>>> #include <stdio.h> int xxx; int main() { printf( "xxx is %d\n", xxx ); return 0; } <<<file_2.c>>> int xxx = 8; Those two files comprise an ANSI/ISO compliant C program which produces a well-defined result. A compiler which fails to compile this is not ISO compliant. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. _______________________________________________ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel