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: Do C++ signed types have modulo semantics?


>>>>> "Steven" == Steven Bosscher <stevenb@suse.de> writes:

 Steven> Indeed.  Frankly this "seems likely" guess confuses me.  It
 Steven> is already well known that using unsigned types for loop
 Steven> counters may greatly improve the code gcc can generate for
 Steven> loops.  With wrap-around semantics, suddenly countable loops
 Steven> are turned into noncountable loops, overflow can occur,
 Steven> dependencies may be introduced that never happen in reality,
 Steven> and so on.

I must be missing something.  Unsigned has wraparound (modulo)
semantics.  So if unsigned loop counters produce better code, why does
making signed ints wrap cause worse code rather than better (just as
good as unsigned) code?

     paul


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