What is the rationale for the Standard Committee to leave the opportunity to distinguish values ββand especially non-negative values ββfor WEOF?
The int type is always signed, a negative value is always included in the range, so the EOF macro can be defined by the standard as -1.
However, the wint_t type can be signed with or without unsigned 1; therefore, the WEOF macro cannot be defined by the standard as a specific value. The implementation must choose it. Since the implementation defines the type wint_t and its signature, it must also select a value for WEOF.
1 (Quoted from: ISO / IEC 9899: 201x 7.20.3 Limits of other integer types 5)
If wint_t (see 7.29) is defined as a signed integer type, the value of WINT_MIN must be no more than -32767, and the value WINT_MAX must be at least 32767; otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN must be 0, and the value of WINT_MAX must be at least 65535.
source share