This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Autoconf 2.59 breaks libstdc++ checks


Gunther Nikl <gni@gecko.de> writes:

>   What about getc, putc and putchar from stdio?

The C standard says that they are functions.  The only difference to other
functions is that getc and putc are allowed to evaluate the second
argument twice when implemented as macro.  But they must still be
available as normal functions as well.

>   BTW, is it legal to implement these macros as functions using the macros
>   itself?
>
>     #include <stdio.h>
>     int (getc)(FILE *stream) { return getc(stream); }
>
>   This will break if getc isn't a macro.

Undefined behaviour.  You are not allowed to redefine standard functions.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]