Float Double Parameters; extern/static scope

KW Heuer kwh at bentley.UUCP
Thu Apr 17 01:30:50 AEST 1986


In article <1377 at lll-crg.ARpA> brooks at lll-crg.ARpA (Eugene D. Brooks III) writes:
>The reason for keeping the conversion in is purely historical.
>Its called those old dusty decks (sorry, files).  The way that
>the proposed ANSI standard deals with the problem, introduce
>function prototypes, seems like a reasonable way to provide
>efficiency for those who need it while at the same time not
>breaking old code.

I haven't seen the proposed standard, but from the conversation so far I
gather that "f(x) float x; { ... }" will involve widening whereas the new
syntax "f(float x) { ... }" will not.  (And likewise "extern f(float)" is
the signal to the compiler that the caller should not widen the argument.)
Hmm, I'd say things are going to be a bit confusing for a while, but it's
not easy to phase in a new idea.  (I presume the old syntax will be dropped
eventually, like the "=+" anachronisms.)

What's the word on extern vs. static scope for external identifiers?  Last
I heard, there was some talk about changing the default from extern to
static, but I think it got dropped for compatibility reasons.  (Also, C++
was supposed to have static as a default, but Bjarne had to revert back to
extern to maintain peaceful coexistence with C.)  I think this modification
should be phased in, too; the first step would be to issue a warning on an
external definition like "int i = 4;" and "void f() {...}" (warning: extern
scope assumed) and force the user to specify either "static int i = 4;" and
"static void f() {...}", or "extern int i; int i = 4;" and "extern void f();
void f() {...}", whichever was intended.  Then the default could be changed
(warning: static scope assumed) and finally the warning could be dropped.
I'd like to see this introduced with the ANSI standard.

Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint



More information about the Comp.lang.c mailing list