This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: Re: [PATCH] New functions wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf


Eric Blake wrote:
>By this day and age, _HAVE_STDC should always be set, and we should be
able to 
>blindly #include <stdarg.h> without worrying about the obsolete
<varargs.h>.  
>Likewise for all futher uses of _HAVE_STDC in this file.
I agree.  This also extends to the function prototypes and definitions,
where I think that it's high time to get rid of the _DEFUN and _EXFUN
stuff going forward.  (All of these new functions were introduced by
standard C, so requiring a standard C compiler for them is completely
reasonable.)

>> Index: libc/stdio/vfwprintf.c
>> ===================================================================
>> +	/* sorry, fwprintf(read_only_file, "") returns WEOF, not 0 */
>> +	if (cantwrite (data, fp)) {
>> +		_funlockfile (fp);
>> +		return (WEOF);
>
>Are we guaranteed that WEOF is negative?  WEOF is of type wint_t, and
it is 
>feasible (although I don't know of any systems that do this) that
wint_t could 
>be unsigned, and that (int)WEOF is not negative.  Since *wprintf return
int and 
>not wint_t, shouldn't this be an explicit -1 rather than WEOF?
 
Good catch:  yes, it should be an explicit -1 (or any other negative).
(C99 is explicit that wint_t (and wchar_t, for that matter) may be
unsigned.)  And as you note by the *wprintf, the correction needs to
occur
in multiple places.

Craig


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