On Mon, 2 May 2016, Bjoern A. Zeeb wrote: > > > On 02 May 2016, at 16:08 , Conrad Meyer <c...@freebsd.org> wrote: > > > > On Mon, May 2, 2016 at 8:57 AM, Benjamin Kaduk <bjkf...@gmail.com> wrote: > >> On Mon, May 2, 2016 at 10:54 AM, Bjoern A. Zeeb <b...@freebsd.org> wrote: > >>>> On 02 May 2016, at 15:32 , Conrad Meyer <c...@freebsd.org> wrote: > >>>> > >>>> Clang should really catch this too. Why didn’t it? > >>> > >>> It was only powerpc; sparc64 and mips were good as well. > >> > >> 'char' being signed vs. unsigned? > > > > Yeah, that occurred to me, but EOF should be out of range for any char > > type. I'd like ((char)getchar() == EOF) to warn on all platforms. > > I think we just define EOF to be -1. Someone should check, and that the > warning message might be misleading.
Yeah, stdio.h has: #define EOF (-1) If char is signed, that gets more exciting, due to the value-preserving promotion rule (after the char cast, it gets converted back to int for the comparison operation). Also, -1 is assumed to be EOF in external code, e.g., contrib/top/getopt.c. -Ben _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"