<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Dec 23, 2014 at 7:03 PM, John Denker <span dir="ltr"><<a href="mailto:jsd@av8n.com" target="_blank">jsd@av8n.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 12/23/2014 02:05 PM, Dave Horsfall wrote:<br>
<br>
> I still remain astonished, that, since Babbage/Lovelace/Turing/etc, that<br>
> many alleged programmers still do not know that 0.0 != 0.</blockquote><div><br></div><div> Sigh...  </div><div>This is so astoundingly opaque that those that say "don't do it</div><div>are correct" even without knowing why in a specific case.</div><div><br></div><div>I have seen a very long list of comparison permutations</div><div>both intended and unintended.</div><div>string--string</div><div>string--int</div><div>string--float</div><div>string--reference-to{string, float, double,int, long int,}</div><div>etc... etc...</div><div><br></div><div>Historically in C "0" was shorthand for int 0 but </div><div>could be 8 bits, 16 bits, 32 bits, 64 bits all zero.</div><div>signed and unsigned can complcate it all. Float </div><div>of size 32bit would be 0.0 but could have been 64bit.</div><div><br></div><div>Depending on the version of C and the compiler </div><div>promotions to float or something bigger might happen</div><div>or not.  Signed and unsigned is an additional tangle.</div><div>Demotion to smaller gets done by some.</div><div><br></div><div>Shell scripts are notorious...</div><div><br></div><div>In this case the compiler will see these as constants</div><div>and evaluate the expression and insert the answer</div><div>in the code and not "show the work".   When symbols</div><div>are involved propagation of type gets interesting. </div><div><br></div><div>So strictly type all constants and variables cast rarely </div><div>(iff needed. The use of assertions for anything that might be</div><div>compiler evaluated to a constant is worth the effort</div><div>and assert() can ultimately be free.</div><div><br></div><div>Programming language and API+ABI get involved</div><div>especially with languageA--languageB interfaces and calling conventions.</div><div><br></div><div>The key to cryptography here is to type each and every  "thing" so </div><div>the compiler knows what the author is drying to do.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">  T o m    M i t c h e l l</div></div>
</div></div>