On 04/17/2014 08:04 PM, Matej Nanut wrote:
The expansion with gotos explains the behaviour nicely! Cool.
The error about fall-through is still missing though?
Good point, this error should probably be triggered. I guess the problem
is roughly that indeed every case statement in the code is te
The expansion with gotos explains the behaviour nicely! Cool.
The error about fall-through is still missing though?
Also, I'm sorry for my sparse and perhaps erratic replies. For some
reason, most of the messages in this thread are missing from my Inbox.
The only reply I saw was the first one by
On Thu, 17 Apr 2014 10:26:01 -0400, Timon Gehr wrote:
On 04/17/2014 03:15 PM, Steven Schveighoffer wrote:
If the break breaks the foreach, why isn't just case 1 produced? That
would be an actual break in the foreach, no?
No. You don't know the dynamic behaviour of the code at runtime just b
On 04/17/2014 03:15 PM, Steven Schveighoffer wrote:
But should a foreach over a tuple a breakable statement?
Well, it is a foreach statement.
It is on the other hand not too clear what to do about 'static foreach',
but I am leaning towards banning non-labelled break and continue inside it.
On Thu, 17 Apr 2014 06:54:39 -0400, Timon Gehr wrote:
On 04/08/2014 05:14 PM, Steven Schveighoffer wrote:
On Mon, 07 Apr 2014 18:30:30 -0400, Matej Nanut
wrote:
Hello,
I don't understand why so many break statements are needed in this
construct:
immutable key = 3;
switch (key)
On 04/08/2014 05:14 PM, Steven Schveighoffer wrote:
On Mon, 07 Apr 2014 18:30:30 -0400, Matej Nanut
wrote:
Hello,
I don't understand why so many break statements are needed in this
construct:
immutable key = 3;
switch (key)
{
foreach (c; TypeTuple!(1, 2, 3, 4, 5))
Well, I'm still confused by this. I also noticed that the compiler
doesn't complain if I omit the break statements in the generated
switch, but complains normally if I write it out like so:
```
switch (key)
{
case 1: "Found 1!".writefln();
break;
case 2: "Fo
On Mon, 07 Apr 2014 18:30:30 -0400, Matej Nanut
wrote:
Hello,
I don't understand why so many break statements are needed in this
construct:
immutable key = 3;
switch (key)
{
foreach (c; TypeTuple!(1, 2, 3, 4, 5))
{
case c: "Found %s!".writefln(c);
On 8 April 2014 02:30, bearophile wrote:
> On default compile the D code with warnings active.
I'm not sure what you mean? I have the -w and -wi flags always enabled
and I don't get any warnings. I'm using DMD 2.065.
Firest, complete code to save others' time:
import std.stdio;
import std.typetuple;
void main()
{
immutable key = 3;
switch (key)
{
foreach (c; TypeTuple!(1, 2, 3, 4, 5))
{
case c: "Found %s!".writefln(c);
break;
}
break
Matej Nanut:
break; // Default always gets executed without this
break.
On default compile the D code with warnings active.
Bye,
bearophile
Hello,
I don't understand why so many break statements are needed in this construct:
immutable key = 3;
switch (key)
{
foreach (c; TypeTuple!(1, 2, 3, 4, 5))
{
case c: "Found %s!".writefln(c);
break;
}
break; // Default a
12 matches
Mail list logo