The ISO C90 standard, where wchar_t was introduced, does not say anything specific about the presentation. It only requires that this type is capable of storing all elements of the basic character set.
This means that wchar_tit may well be type char, and it wint_tmay be type int. In addition, in some implementations it wchar_tcan be signed, and in some - unsigned. What situation is different from putchar()?
For comparison, the argument putchar(), putc()and fputc()
was chosen equal int.
I think that none of the library functions that process single characters work with char(only with int), because although some of them do not use EOF (for example, putchar()), we cannot make it type char, because if it was char, and we output to unsigned char(signature is charnot standardized), there will be a type of conversion warning like
void f(char c) { ...
...
int x = 't';
f((unsigned char)x);
...
warning: conversion to ‘char’ from ‘unsigned char’ may change the sign of the result
Thus, the only option was to make it int, which can contain both signed and unsigned char.
Although the argument is automatically converted to unsigned charby putchar (), even if it was passed as an int or char signed, nothing of the kind was done in putwchar ().
, fputwc(), putwc() putwchar() wchar_t, wint_t? . - ?
. forlower() EOF? putchar(), fputc() putc() char? fputwc(), putwc() putwchar() glibc
UPDATE
glibc
wchar_t char, wint_t int - .
wchar_t char
, " ISO SC22/WG14/N204 31 1992 " ( "ISO/IEC 9899: 1990/Amendment 1:1995" ), "/ 9899: 1990/ 1:1995". . http://www.unix.org/version2/whatsnew/login_mse.html