This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: signed is undefined and has been since 1992 (in GCC)


>>>>> "Robert" == Robert Dewar <dewar@adacore.com> writes:

 Robert> I am puzzled, why would *ANYONE* who knows C use int rather
 Robert> than unsigned if they want wrap around semantics?

Because most people don't follow the rule that "always use unsigned
variables unless you know that it really needs to be signed".

And also because most people believe that C applies normal computer
arithmetic, and they believe that normal computer arithmetic is
wrapped 2's complement.  (And indeed it usually is, give or take some
bizarre exceptions like MAX_INT % -1)

We all know better, but how tiny is the fraction of C programmers who
have ever even *seen* the ANSI C spec, much less know in detail what
it says?

	paul


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