<div class="gmail_quote">On Wed, Jul 18, 2012 at 5:41 PM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Hi Richard,<div><br></div><div>I think this checking is quadratic, n(n+1)/2.</div></div></blockquote><div>Yes it is.  It does perform a check between each enum in the worst case.</div><div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>  This might be fairly expensive on a large set of enums.  Do you have any performance numbers?</div>
</div></blockquote><div>I haven't run any performance tests.  I will try running some when I get the chance.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>  I agree that it is a good checking, but the way it is implemented is likely to be noticeably slow on some (important) cases.</div></div></blockquote><div>How many elements in an enum would be in these important cases? </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>Ted</div><div><br><div><div><div class="h5"><div>On Jul 18, 2012, at 4:46 PM, Richard Trieu <<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.com</a>> wrote:</div>
<br></div></div><blockquote type="cite"><div><div class="h5"><a href="http://llvm.org/bugs/show_bug.cgi?id=6343" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=6343</a><div><br></div><div>Warn on enum elements that are assigned values already in use.  This is based on the misconception that elements not given a value will be given the next smallest, unused value.  Instead, elements are assigned 1 more than the previous value.  Some example code this warning will catch:</div>


<div><br></div><div>enum { A, B, C, Aref = A, count };</div><div>Both B and count will have value 1.</div><div><br></div><div>enum { A, B, C, D = -1, E, F };</div><div>A = E = 0</div><div>B = F = 1</div><div><br></div><div>

This warning found one such issue in LLVM that was fixed in r160465.</div>
</div></div><span><duplicate-enum.patch></span>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br></blockquote></div><br></div></div></blockquote></div><br>