Email List: Xaustin-group-lX
[All Lists]

Re: Defect in XSH creat

To: "Schwarz, Konrad" <yyyyyyyyyyyyyy@xxxxxxxxxxx>
Subject: Re: Defect in XSH creat
From: Paul Eggert <yyyyyy@xxxxxxxxxxx>
Date: Fri, 24 Nov 2006 01:04:15 -0800
Cc: <yyyyyyyyyyyyyy@xxxxxxxxxxxxx>
References: <ECDC9C7BC7809340842C0E7FCF48C393EFCD9D@MCHP7IEA.ww002.siemens.net>
"Schwarz, Konrad" <yyyyyyyyyyyyyy@xxxxxxxxxxx> writes:

> What about the license granted to standard C library implementers to
> provide a macro of the same name as the function?  This prevents all use
> of tokens with names identical to functions defined in the standard
> library if the appropriate header is included, unless of course the
> macro is explicitly undefined.

Yes, sorry, I should have made it clear that I was relying on the
freedom granted by the C99 standard to undefine system-supplied macros
whose names do not begin with _[A-Z_].

So the following contrived C99 program should read from stdin:

   #include <stdio.h>
   #undef getc
   int main (void) {
     int (*getc) (FILE *) = ferror;
     return getchar ();
   }

However, on systems where <stdio.h> incorrectly implements getchar
with "#define getchar() getc(stdin)", the program invokes the system
ferror() instead of the system getc().

<Prev in Thread] Current Thread [Next in Thread>