Questions on X3J11 draft

rbutterworth at watmath.UUCP rbutterworth at watmath.UUCP
Sat Dec 6 01:34:55 AEST 1986


> > 5) Has any attempt been made to see what percentage of existing
> > code (say at AT&T or wherever) would break under the X3J11 draft?
> I suspect AT&T has been paying close attention to this, although I don't
> know of any actual numbers.  The intent all along has been that existing
> *legal* code will not break.

I can think of a perfectly conforming ANSI compiler that will break
almost any existing C code.  Imagine a piece of code such as the following:
    #include <stdio.h>
    {
        extern int getchar();
        auto int c;
        c=getchar();
At the moment, this will blow up on (all?) existing C compilers since
"getchar" is a macro.  Of course everyone KNOWS this and so never puts
such things into their code.  But under ANSI, almost any function can
be defined as a macro in the header files.  That means that almost
any program that contains an "extern type libCfunc();" in it can
potentially break under a conforming ANSI compiler.

This change may or may not be a good thing; I don't know.
I do know that my own coding style has changed drastically
because of it.  I used to put explicit extern statements for
all the functions I use, simply to document the fact that I
am using them.  Now I NEVER put extern statements into ANY
source.c file.



More information about the Comp.lang.c mailing list