On 8/17/97 6:57 AM, David Klasinc (bigwhale@CAPYBARA.SK-PTTSC.LJ.EDUS.SI) stated: > >ObCircle2: > > Now something about the coding... What will run faster a bunch of if's or >switch? :) > Neither. switches are basically a C convenience shorthand for a bunch of ifs/elseifs, so: if (i == 1) { ... } else if (i == 2) { ... } else if (i == 3) { ... } else if (i == 4) { ... } else { ... } and switch (i) { case 1: ... break; case 2: ... break; case 3: ... break; case 4: ... break; default: ... } Will (should) produce the exact same assembly. +------------------------------------------------------------+ | 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/08/00 PST