Skip to content

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Sep 12, 2011

Replace goto with throw in std.format function.

This code is just asking for trouble.... :o)

@9rnsr
Copy link
Contributor

9rnsr commented Sep 13, 2011

Thrown UtfException is never used, so how about you changing like follows?

-        catch (UtfException e)
+        catch (UtfException)
         {
 InvalidSeq:

@9rnsr
Copy link
Contributor

9rnsr commented Sep 13, 2011

Or, we can extract "invalid sequence handling" out of catch statement.

  bool invalidSeq = false;
  try {
    ... // may throw UtfException
    if (c == 0xFFFE || c == 0xFFFF)
    { invalidSeq = true; goto LinvalidSeq; }
    ...
  } catch (UtfException) {
    invalidSeq = true;  // Come here if only exception was really thrown
  }

LinvalidSeq:
  if (invalidSeq)
  { /* error handling */ }

@ibuclaw
Copy link
Member Author

ibuclaw commented Sep 13, 2011

Andrei - it's a comment in diguise. :~)

9rnsr - sure, that way would be great too (give me a couple of hours to prepare / commit it)

9rnsr added a commit that referenced this pull request Sep 13, 2011
Remove goto into catch block.
@9rnsr 9rnsr merged commit 3b4aca5 into dlang:master Sep 13, 2011
@ibuclaw ibuclaw deleted the gotoCatch branch July 19, 2014 10:39
kuettler pushed a commit to kuettler/phobos that referenced this pull request Feb 6, 2018
Add script to query for contributors between two releases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants