Is this a bug? +goto
MatheusBN
m at gmail.com
Tue Nov 6 03:10:27 UTC 2018
On Tuesday, 6 November 2018 at 01:05:04 UTC, Neia Neutuladh wrote:
> In C++, if you skip over `int i = 10;` it's an error, but not
> if you skip over `int i;`.
In fact I agree with that rule more than the D one to be honest.
Since It isn't initialized and never used, I think a warning
should be enough instead of an error.
On the other hand, if there is a possibility that the variable
can be accessed, then an error should be throw.
Like:
{
goto Q:
int x;
Q:
x = 10; // An error is ok.
}
But here:
{
goto Q:
int x; // An warning should be enough in my IMHO.
Q:
return;
}
MatheusBN.
More information about the Digitalmars-d-learn
mailing list