Re: switch vs if

From: George (greerga@CIRCLEMUD.ORG)
Date: 05/03/98


On Sun, 3 May 1998, Chris Powell wrote:

>WHich is quicker
>if (this == that || this == that2)
>or
>switch (this) {
>  case that:
>  case that2:

Use 'gcc -S' and see what the resulting assembly is.  It also depends on
optimization, your compiler, and the alignment of the planets.

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST