(Stefan Ram) writes:
>6.4.4.4p10: »The value of an integer character constant
>containing a single character that maps to a single-byte
>execution character is the numerical value of the
>representation of the mapped character interpreted as an
>integer.«
6.4.4.4p2: »An integer character constant is a sequence of
one or more multibyte characters enclosed in single-quotes,
as in 'x'.«
Thus, 'x' is an integer character constant. It contains a
single character.
I guess, it maps to the single-byte execution character »x«.
But why?
5.1.1.2p1,5. »Each source character set member and escape
sequence in character constants and string literals is
converted to the corresponding member of the execution
character set«
But where is this correspondence being defined? This seems
to be implied by the text, but not explictly specified.
So, it seems to be safe to assume that 'x' is being mapped
to the execution character »x«. Actually, to the numerical
value of its representation.
In ASCII 1968 this representation is: 1111000, the numerical
value of which is 120.
Thus, the value of 'x' is 120 on a C implementation with
ASCII as its execution character set.
>7.19.7.3p2: »The fputc function writes the character
>specified (...) to the output stream pointed to by stream«.
In »fputc( 'x', textstream )«, fputc or the text stream do
not have to do any more work to convert to the execution
character set, because 'x' already is the numerical value of
the proper representation.
The first parameter of fputc is int, so it can accept int or
char as argument type and the question whether int or char
is used does not have to do anything with the question
whether the numerical value represents a character or not.