<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 21 February 2014 01:20, Steven Schveighoffer <span dir="ltr"><<a href="mailto:schveiguy@yahoo.com" target="_blank">schveiguy@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, 20 Feb 2014 10:13:27 -0500, Daniel Murphy <<a href="mailto:yebbliesnospam@gmail.com" target="_blank">yebbliesnospam@gmail.com</a>> wrote:<br>

<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
"Steven Schveighoffer"  wrote in message news:op.xbk44onleav7ka@<u></u>stevens-macbook-pro.local...<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What I really would be curious about is if in most D code, you see a lot more default: break; than default: assert(0);<br>
</blockquote>
<br>
I just did a quick git-grep on the compiler source (not D, but all switches do have a default thanks to the d port)<br>
<br>
With 707 "default:"s 68 had a break on either the same or next line, and 249 had an assert(0).<br>
<br>
On phobos I get 22 assert(0)s vs 10 breaks with 147 defaults<br>
<br>
With druntime i get 24 assert(0)s + 5 error();s vs 11 breaks with 64 defaults.<br>
</blockquote>
<br></div></div>
Good data, but I was more thinking of people who use D, not the core language. The core language's developers have different behaviors than standard users. I'm not dismissing this data, but I would like to see more application statistics.<br>
</blockquote><div><br></div><div>In my little app:</div><div> 17 default: break;</div><div> 1 default: assert(0); ... and I just realised it should have been a final switch() anyway... so now there's 0.</div><div><br>
</div><div>I haven't just been lazy, the default case just happens to be as if an unhandled else in many cases.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Another interesting data point would be whether any of those asserts were inserted after the language deprecated missing defaults, or if they existed beforehand.<br>
<br>
One thing that is nice is how asserts are supported in D. It makes this a much easier decision.<br>
<br>
-Steve<br>
</blockquote></div><br></div></div>