<div dir="ltr">Rohit, I&#39;m not sure when you think this change occurred but as far as I can recall (and I&#39;ve just tested that memory with Delphi 7) it has never been possible to have duplicate case labels. If it were, I&#39;m pretty sure it would have been considered a bug and would have been fixed as such.<br><br>My C is too rusty to recall whether C formally allows duplicate case labels, but I seem to recall that even if not possible then it is possible to simulate same/similar effects by injudicious use (or omission) of break&#39;s within the switch but that this is generally frowned upon.<br><br><br>To answer the original question, a simple test case and use of the disassembly view confirms that the compiler produces different code for each variant.  The code in each case performs a simple test of integer <b>a</b> and simply shows a message if the test evaluates as true:<br><br><div><b>Unit12.pas.35: if a in [1, 3] then</b></div><div>005B166C A164535C00       mov eax,[$005c5364]</div><div>005B1671 83E801           sub eax,$01</div><div>005B1674 7405             jz $005b167b</div><div>005B1676 83E802           sub eax,$02</div><div>005B1679 750A             jnz $005b1685</div><div><b>Unit12.pas.36: ShowMessage(&#39;in&#39;);</b></div><div>005B167B B898165B00       mov eax,$005b1698</div><div>005B1680 E8A34AF9FF       call ShowMessage</div><div><br></div><div><br></div><div><b>Unit12.pas.41: if (a = 1) or (a = 3) then</b></div><div>005B16AC 833D64535C0001   cmp dword ptr [$005c5364],$01</div><div>005B16B3 7409             jz $005b16be</div><div>005B16B5 833D64535C0003   cmp dword ptr [$005c5364],$03</div><div>005B16BC 750A             jnz $005b16c8</div><div><b>Unit12.pas.42: ShowMessage(&#39;() or ()&#39;);</b></div><div>005B16BE B8D8165B00       mov eax,$005b16d8</div><div>005B16C3 E8604AF9FF       call ShowMessage<br><br><br>How this scales w.r.t many more items in the set membership being tested I don&#39;t know, but you can see from this that the OR&#39;d value comparisons is compiled as multiple comparisons where-as the set membership test produces very different ASM.<br><br>I don&#39;t know x86 ASM well enough to say which of these is more efficient but the simple fact that they are different suggests that there is likely to be a difference in performance (and I suspect that multiple CMP&#39;s are likely to be more costly than whatever contrivance is involved in the set membership test).<br><br>NOTE: This is the dis-assembly of Delphi XE4 Win32 code.  Code produced for other targets may (almost certainly will) vary.</div><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 28 July 2016 at 14:52, Rohit Gupta <span dir="ltr">&lt;<a href="mailto:rohit@cfl.co.nz" target="_blank">rohit@cfl.co.nz</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Steve,<br>
      <br>
      I am pretty sure you are correct.  This happened when they
      scrapped the pascal compiler and changed the c compiler to do
      pascal.  One of the changes then was that you could not use the
      same selector value twice in the case statement.  Before that
      time, you could.<br>
      <br>
      Rohit<div><div class="h5"><br>
      <br>
      On 8/06/2016 17:27, Steve Peacocke wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      
      <div>If I remember correctly, the compiler changes both to array
        anyway so you come out with exactly the same compiled code. </div>
      <div><br>
      </div>
      <div>Perhaps someone can confirm this or
        tell me how wrong I am?<br>
        <br>
        Steve Peacocke
        <div>+64 220 612-611</div>
        <div><br>
        </div>
      </div>
      <div><br>
        On 8/06/2016, at 4:56 PM, Ross Levis &lt;<a href="mailto:ross@stationplaylist.com" target="_blank">ross@stationplaylist.com</a>&gt;
        wrote:<br>
        <br>
      </div>
      <blockquote type="cite">
        <div>
          
          
          
          <div>
            <p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">I’m wondering
                which is more efficient to process...<u></u><u></u></span></p>
            <p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d"><u></u> <u></u></span></p>
            <p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">if (a=1) or (a=2)
                then ...<u></u><u></u></span></p>
            <p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d"><u></u> <u></u></span></p>
            <p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">or<u></u><u></u></span></p>
            <p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d"><u></u> <u></u></span></p>
            <p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">if a in [1,2]
                then ...<u></u><u></u></span></p>
            <p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d"><u></u> <u></u></span></p>
            <p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">If the answer is
                the first method, does it make a difference if more
                numbers are checked, eg. if a in [1..3,5] then<u></u><u></u></span></p>
            <p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d"><u></u> <u></u></span></p>
            <p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">Cheers.</span><span style="font-size:12.0pt;color:#1f497d"><u></u><u></u></span></p>
          </div>
        </div>
      </blockquote>
      <blockquote type="cite">
        <div><span>_______________________________________________</span><br>
          <span>NZ Borland Developers Group - Delphi mailing list</span><br>
          <span>Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a></span><br>
          <span>Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a></span><br>
          <span>Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a>
            with Subject: unsubscribe</span></div>
      </blockquote>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</pre>
    </blockquote>
    <p><br>
    </p>
    </div></div><div>-- <br>
      <p>
        Regards<br>
        <br>
        <b>Rohit Gupta</b><br>
        B.E. Elec., M.E., Mem IEEE, Mem IET<br>
        Technical Director<br>
        Computer Fanatics Ltd<br>
        <br>
        <b>Tel </b>4892280 <br>
        <b>Fax </b>4892290 <br>
        <b>Web </b><a href="http://www.cfl.co.nz" target="_blank">www.cfl.co.nz</a><br>
      </p>
      <hr>
      This email and any attachments contain information, which is
      confidential and may be subject to legal privilege and copyright.
      If you are not the intended recipient, you must not use,
      distribute or copy this email or attachments. If you have received
      this in error, please notify us immediately by return email and
      then delete this email and any attachments.</div>
  </div>

<br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" rel="noreferrer" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div>