Chris:

[2]
Another issue I encountered was when I recompiled the library, dmd 2.065 gave me an error that a goto statement skipped a variable. The case is as follows:

if (condition) {
  goto Label;
}

auto variable = getVariableValue(); // Only needed, if "condition" above not true // do things with variable here (needed for what comes after "Label"

Label:
// Finish everything

I know that scope would be better and this is the only goto I have left. In order for the code to compile I had to move (as a quick fix)

auto variable = getVariableValue();

to before the if (condition) statement. Is this by design?

D specs state that gotos can't be used to skip a variable definition. In the last compiler version this rule has being implemented and enforced. So the original code was not D-conformant.

Bye,
bearophile

Reply via email to