Machine specific predefined names

Larry Jones scjones at sdrc.UUCP
Tue Feb 23 09:36:27 AEST 1988


In article <17033 at watmath.waterloo.edu>, rbutterworth at watmath.waterloo.edu (Ray Butterworth) writes:
> But consider a different related problem:
> 
>     #include <stdlib.h>
>     #include <stdio.h>
>     int putchar(int n) { abort(n); }
>     main() { perror("xx"); }
> 
> Now if perror() needs putchar() to write the message, will it use
> my version of putchar or an internal version, say _putchar()?
[stuff omitted for brevity]
> I didn't see anything in the standard to indicate that either of
> these behaviours is right or wrong.

The draft clearly indicates in section 4.1.2 that every external identifier
declared in a standard header is reserved whether the header is included or
not and that redefining a reserved external identifier results in undefined
behaviour.  Thus, either behaviour is acceptable and your program is not
strictly portable.

----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                MAIL: 2000 Eastman Dr., Milford, OH  45150
                                    AT&T: (513) 576-2070
"When all else fails, read the directions."



More information about the Comp.lang.c mailing list