Questions on X3J11 draft
Mark Biggar
markb at sdcrdcf.UUCP
Tue Dec 9 09:04:05 AEST 1986
In article <775 at axis.UUCP> philip at axis.UUCP (Philip Peake) writes:
>In article <3800 at watmath.UUCP> rbutterworth at watmath.UUCP writes:
>>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.
>How can I know, when trying to write portable code, if the 'library'
>function I am going to use is a real function or a macro ?
Easy, you say (using the above example):
#ifndef getchar
extern int getchar();
#endif
Mark Biggar
{allegra,burdvax,cbosgd,hplabs,ihnp4,akgua,sdcsvax}!sdcrdcf!markb
More information about the Comp.lang.c
mailing list