Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Blocks in C (Score:3, Informative)

    with two returns in a row
    Not quite. Single statement blocks in C don't need surrounding braces, so the two returns there do make sense. The first one is associated with the else branch. As the reverse indenting attempts to make clear :)
    • Wait a minute. Okay, I'm no C jockey, but doesn't this mean the final return statement could never be reached?
      if (SvPOK(sv)) {
        sbegin = SvPVX(sv);
        len = SvCUR(sv);
      }
      else if (SvPOKp(sv))
        sbegin = SvPV(sv, len);
      else
        return 1; /* Historic.  Wrong?  */

      return grok_number(sbegin, len, NULL);
      I've got my K&R right here, buddy! ;)
      --
      The great thing about multitasking is that several things can go wrong at once.
      • Re:Blocks in C (Score:4, Informative)

        No. The "return grok_number" still gets called if either SvPOK or SvPOKp return a true value.

        For example, if SvPOK returns true, then sbegin and len are set and the program execution moves to the first statement _after_ the if/else block, i.e. the "return grok_number".

        It's been a loong time since I wrote C, and my memory could be fading, but I'm pretty sure I'm right here.