Thread overview | |||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
December 09, 2003 switch voting | ||||
---|---|---|---|---|
| ||||
<joke> (better viewed with monospaced font) I now declare the end of the argumentation :) the jury will now vote: M - must D - desirable W - who cares N - NO | remove | | runtime | Implicit | throw on | break and| | missing | multiple | Mandatory | | default | values | default | +----------+----------+-----------+ | M - 2 | M - 0 | M - 0 | Total | D - 0 | D - 1 | D - 0 | | W - 0 | W - 0 | W - 1 | | N - 1 | N - 0 | N - 0 | +----------+----------+-----------+ | M | D | W | Ant +----------+----------+-----------+ | M | | | MW +----------+----------+-----------+ | N | | | WB +----------+----------+-----------+ by multiple values I mean "case 1,3,43,19..23:" seems to me that you shouldn't have implicit break without multiple values. I took the liberty to create two extra example voters with ficticious initials (any relations to D users is purelly coincitdental ;) </joke> (I guess what I really mean is that every body is saying the same thing over and over again) Ant |
December 09, 2003 Re: switch voting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | | M | M | M | MW (Actually all this does not apply to me, because I *always* write the default. I do this reliably since I always write it immediately after I've written switch. Interestingly, having an explicit, but empty, default causes most C++ compilers to generate less efficient code, so in some "cases" it is better to not have a default in there. But if you want to hear more about that you'll have to buy the book! <g> ) "Ant" <Ant_member@pathlink.com> wrote in message news:br5h0m$u59$1@digitaldaemon.com... > <joke> > (better viewed with monospaced font) > I now declare the end of the argumentation :) > the jury will now vote: > > M - must > D - desirable > W - who cares > N - NO > > | remove | > | runtime | Implicit > | throw on | break and| > | missing | multiple | Mandatory | > | default | values | default | > +----------+----------+-----------+ > | M - 2 | M - 0 | M - 0 | Total > | D - 0 | D - 1 | D - 0 | > | W - 0 | W - 0 | W - 1 | > | N - 1 | N - 0 | N - 0 | > +----------+----------+-----------+ > | M | D | W | Ant > +----------+----------+-----------+ > | M | | | MW > +----------+----------+-----------+ > | N | | | WB > +----------+----------+-----------+ > > by multiple values I mean "case 1,3,43,19..23:" > seems to me that you shouldn't have implicit break > without multiple values. > > I took the liberty to create two extra example voters > with ficticious initials (any relations to > D users is purelly coincitdental ;) > </joke> > > (I guess what I really mean is that every body is saying the > same thing over and over again) > > Ant > > |
December 09, 2003 Re: switch voting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | I wanna vote, too!
| M | M | N | JCC
Let's make it easy to program in D. If the programmer knows he needs to handle every case he can use "default: assert(0);" or whatever solution he prefers. We're all grown-ups here, right?
Justin
Ant wrote:
> <joke>
> (better viewed with monospaced font)
> I now declare the end of the argumentation :)
> the jury will now vote:
>
> M - must
> D - desirable
> W - who cares
> N - NO
>
> | remove |
> | runtime | Implicit
> | throw on | break and|
> | missing | multiple | Mandatory |
> | default | values | default |
> +----------+----------+-----------+
> | M - 2 | M - 0 | M - 0 | Total
> | D - 0 | D - 1 | D - 0 |
> | W - 0 | W - 0 | W - 1 |
> | N - 1 | N - 0 | N - 0 |
> +----------+----------+-----------+
> | M | D | W | Ant
> +----------+----------+-----------+
> | M | | | MW
> +----------+----------+-----------+
> | N | | | WB
> +----------+----------+-----------+
>
> by multiple values I mean "case 1,3,43,19..23:"
> seems to me that you shouldn't have implicit break
> without multiple values.
>
> I took the liberty to create two extra example voters
> with ficticious initials (any relations to
> D users is purelly coincitdental ;)
> </joke>
>
> (I guess what I really mean is that every body is saying the
> same thing over and over again)
>
> Ant
|
December 09, 2003 Re: switch voting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Ok, it was a joke, but what the hell... For the record: | remove | | runtime | Implicit | throw on | break and| | missing | multiple | Mandatory | | default | values | default | +----------+----------+-----------+ | M | D | M | HD +----------+----------+-----------+ Hauke |
December 10, 2003 Re: switch voting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Oh, ok. | remove | | runtime | Implicit | throw on | break and| | missing | multiple | Mandatory | | default | values | default | +----------+----------+-----------+ | W | M | N | DL +----------+----------+-----------+ |
December 10, 2003 Re: switch voting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | | remove | | runtime | Implicit | throw on | break and| | missing | multiple | Mandatory | | default | values | default | +----------+----------+-----------+ | N | D | N | PD +----------+----------+-----------+ |
December 10, 2003 Re: switch voting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | | remove | | runtime | Implicit | throw on | break and| | missing | multiple | Mandatory | | default | values | default | +----------+----------+-----------+ | M | D | M | CS +----------+----------+-----------+ "Ant" <Ant_member@pathlink.com> wrote in message news:br5h0m$u59$1@digitaldaemon.com... > <joke> > (better viewed with monospaced font) > I now declare the end of the argumentation :) > the jury will now vote: > > M - must > D - desirable > W - who cares > N - NO > > | remove | > | runtime | Implicit > | throw on | break and| > | missing | multiple | Mandatory | > | default | values | default | > +----------+----------+-----------+ > | M - 2 | M - 0 | M - 0 | Total > | D - 0 | D - 1 | D - 0 | > | W - 0 | W - 0 | W - 1 | > | N - 1 | N - 0 | N - 0 | > +----------+----------+-----------+ > | M | D | W | Ant > +----------+----------+-----------+ > | M | | | MW > +----------+----------+-----------+ > | N | | | WB > +----------+----------+-----------+ > > by multiple values I mean "case 1,3,43,19..23:" > seems to me that you shouldn't have implicit break > without multiple values. > > I took the liberty to create two extra example voters > with ficticious initials (any relations to > D users is purelly coincitdental ;) > </joke> > > (I guess what I really mean is that every body is saying the > same thing over and over again) > > Ant > > |
December 10, 2003 Re: switch voting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Sanders | | remove | | runtime | Implicit | throw on | break and| | missing | multiple | Mandatory | | default | values | default | +----------+----------+-----------+ | D | M | D | GW +----------+----------+-----------+ Mandatory default of course makes the runtime throw obsolete. "Ant" <Ant_member@pathlink.com> wrote in message news:br5h0m$u59$1@digitaldaemon.com... > <joke> |
December 10, 2003 Re: switch voting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Ant wrote:
> <joke>
> [...]
> </joke>
>
> (I guess what I really mean is that every body is saying the
> same thing over and over again)
>
> Ant
The only place I've ever even used switch/case in D is either WndProc, or some similar message enumeration. (SDL, enet, etc) The "throw on no default" thing has caught me exactly once, and it was an easy fix.
I am stunned beyond description that this issue has raised so much discussion. What's the big deal? O_o
-- andy
|
December 10, 2003 Re: switch voting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | Andy Friesen wrote: > The only place I've ever even used switch/case in D is either WndProc, or some similar message enumeration. (SDL, enet, etc) The "throw on no default" thing has caught me exactly once, and it was an easy fix. Yup. It's good for what it's worth. > I am stunned beyond description that this issue has raised so much discussion. What's the big deal? O_o Isn't it always like that with flamewars... I think that Mathew started it, but he wouldn't if i didn't mention it earlier on. :( BTW, we must flame Mathew not to use "alias int boolean" in his libraries. ;) -eye |
Copyright © 1999-2021 by the D Language Foundation