<div>On Wed, Jan 30, 2019 at 11:08 Scott Schurr &lt;<a href="mailto:s.scott.schurr@gmail.com">s.scott.schurr@gmail.com</a>&gt; wrote:<br></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><br></div><div>This clouds the actual issue you&#39;re trying to get at.  Using simply &quot;int&quot; and &quot;unsigned int&quot; for the example solves the problem.<br></div></div></div></blockquote><div>I&#39;m inclined to point the finger at &quot;auto&quot; here. Although this code would also not have been written if we taught to avoid relying on the &quot;modulo&quot; behaviour. The (I believe Google) check while processing JF&#39;s paper was that even unsigned overflow was often a bug.<br></div></div></div></blockquote><div><br></div><div>Yes, I think auto is the problem.  I didn&#39;t want to use auto in the example, but I was trying to get the lines to not wrap in the Tony table.  As many people have noted, auto has fewer characters.  Sounds like I need to get rid of auto in the example and find a way to format the code.  Thanks for pointing that out.</div><div> </div></div></div></div></div></blockquote><div dir="auto"><br></div><div dir="auto">Auto isn’t the only problem: keep in mind that on a 64-bit int system, the int32_t case is fully defined, because there is no overflow on the addition.  The addition is 64-bit, and without auto, it would truncate after the addition.  So on a 64-bit int system, the code will always work regardless of compiler settings, because everything that happens is well-defined.</div><div dir="auto"><br></div><div dir="auto">The existence of alternate possibilities clouds the point you’re trying to make; using int and unsigned int avoids these issues entirely.</div><div dir="auto"><br></div><div dir="auto">Unsigned overflow is usually a bug, but not always.  Many cryptographic operations are defined in terms of wrapping arithmetic.</div><div dir="auto"><br></div><div dir="auto">Melissa</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div></div></div></div></div></div></blockquote></div></div>