On 2018-07-23 20:04:21 +0700, Robert Elz wrote: > Date: Mon, 23 Jul 2018 14:48:36 +0200 > From: Vincent Lefevre <vincent-o...@vinc17.net> > Message-ID: <20180723124836.ga12...@zira.vinc17.org> > > | For the signness, one can just do: (T) -1 < 0 > > Until the brain dead compilers started bitching about comparing > an unsigned number for < 0 (which is impossible, of course, that's > the point)
No, this is not impossible. The result of the test is 0. > and by so doing breaking things - at least in envoronments which > insist on switching on all warnings, and also treating all warnings > as compile errors. If compilers don't handle the above test, they are really broken. (T) -1 < 0 is well defined in C, whether T is signed or unsigned. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)