<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 21 February 2014 03:27, Ary Borenszweig <span dir="ltr"><<a href="mailto:ary@esperanto.org.ar" target="_blank">ary@esperanto.org.ar</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 2/20/14, 1:53 PM, Manu wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
On 21 February 2014 01:20, Steven Schveighoffer <<a href="mailto:schveiguy@yahoo.com" target="_blank">schveiguy@yahoo.com</a><br></div><div class="">
<mailto:<a href="mailto:schveiguy@yahoo.com" target="_blank">schveiguy@yahoo.com</a>>> wrote:<br>
<br>
    On Thu, 20 Feb 2014 10:13:27 -0500, Daniel Murphy<br></div><div class="">
    <<a href="mailto:yebbliesnospam@gmail.com" target="_blank">yebbliesnospam@gmail.com</a> <mailto:<a href="mailto:yebbliesnospam@gmail.com" target="_blank">yebbliesnospam@gmail.<u></u>com</a>>> wrote:<br>
<br>
        "Steven Schveighoffer"  wrote in message<br></div>
        news:op.xbk44onleav7ka@__<u></u>stevens-macbook-pro.local...<div class=""><br>
<br>
            What I really would be curious about is if in most D code,<br>
            you see a lot more default: break; than default: assert(0);<br>
<br>
<br>
        I just did a quick git-grep on the compiler source (not D, but<br>
        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<br>
        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<br>
        with 64 defaults.<br>
<br>
<br>
    Good data, but I was more thinking of people who use D, not the core<br>
    language. The core language's developers have different behaviors<br>
    than standard users. I'm not dismissing this data, but I would like<br>
    to see more application statistics.<br>
<br>
<br></div><div class="">
In my little app:<br>
  17 default: break;<br>
  1 default: assert(0); ... and I just realised it should have been a<br>
final switch() anyway... so now there's 0.<br>
</div></blockquote>
<br>
Did you put those "default: break;" because:<br>
<br>
1. The compiler told it to do so.<br>
2. You already know the compiler will tell you, so you put it before that happens.<br></blockquote><div><br></div><div>Because the compiler told me. It's not a habit of mine to type it.</div><div><br></div><div><br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In the cases where it was "1.", did it make you think whether you needed to handle the default case?<br></blockquote><div><br></div><div>Never. If I meant to handle the case, I would have already handled the case. I've never forgotten to handle the case when I was supposed to.</div>
<div>In the same way I've never forgotten to write else after an if when I intend to.</div></div></div></div>