<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Would this constitute "threaded execution"? I recall being told
      how Forth dispatches in a clever way at the end of each operation
      and the use of "NEXT" seems similar (to my vague memory of the
      description). <br>
    </p>
    <p>One other trick users of C and C++ should consider is function
      references in variables and parameters. Some time back I made a
      "simple pin change" library to give folks three more interrupts
      with the  Atmega328, the one used with the Arduino Uno and Nano
      and others (warning: only tested with that chip). It uses an array
      of functions that resolve to either a dummy internal function or
      the user's desired interrupt handler. If anybody is interested the
      code is here: <a moz-do-not-send="true"
        href="https://bitbucket.org/petesoper/simplepinchange">https://bitbucket.org/petesoper/simplepinchange</a></p>
    <p>The C syntax for pointers to functions gets my vote for hardest
      to remember.<br>
    </p>
    <p>-Pete<br>
    </p>
    <div class="moz-cite-prefix">On 7/1/20 7:18 PM, Jon Wolfe via
      TriEmbed wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:md5:o2pZ6R2v3sG%2Fn33Sf4VahQ==">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
      <div class="WordSection1">
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">In an interesting coincidence, the place
          where I recall seeing the use of goto I described was also in
          a bytecode interpreter, for the “Pawn Scripting language”
          (which is really cool by the way, I’ve got it to run on 8 bit
          AVR, arm cortex-M and also transpiled to JavaScript using
          emscripten, and run inside a browser. It is extremely fast for
          a bytecode interpreter)</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Check out line 208:</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"> <a
            href="https://github.com/compuphase/pawn/blob/master/amx/amxexec_gcc.c"
            moz-do-not-send="true">https://github.com/compuphase/pawn/blob/master/amx/amxexec_gcc.c</a></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">That ‘NEXT’ macro is using a goto behind
          the scenes. Each block of code in between that labels (ie the
          semantic ‘case statement’ equivalents) ends with a NEXT macro,
          so it may actually be faster than even a compiler optimized
          switch-case because there is no ‘loop’ logic needed, to cycle
          back around to the ‘switch’. Its really just a devilish
          jumping around inside that function. </p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">One could argue that ‘break’ and ‘continue’
          statements used inside loops are really just dressed up
          ‘gotos’ with specific jump destinations. I’ve been writing
          code almost daily for close to 30 years, and much of that time
          doing C or C++, and I’d estimate the time in between occasions
          where I used the goto keyword to be 2-5 years, so in other
          words, pretty rare. One of those uses can be for “breaking’
          out of a nested loop. Java has a “break <label>”
          statement that you can use to break out of an outer loop from
          within an inner loop. Standard C/C++ doesn’t have anything
          like that so you have to either use a flag, restructure your
          loops, or use a goto statement. I think it’s a matter of
          option,  on a case by case basis which technique will lead to
          cleaner, easier to follow code in any particular situation. </p>
        <br>
      </div>
    </blockquote>
  </body>
</html>