Re: [Off-Topic Code] Case Statements

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 09/01/97


On Sun, 31 Aug 1997, Brian Gray wrote:

-+> Now, are those break statements needed? doesn't the function return,
-+> stop the function?
-+
-+No, and yes.  The breaks are redundant.  Take them out.

They might be redundant, but C requires they end a "case" statement.  I
personally would right it as:

  switch (xx) {
  case x: return xxx;
  case x: return xxx;
  case x: return xxx;
  default:return xxx; break;
  }

and it'll not give any compiler errors...That is, if you replace the
x's appropriately (duhhh...)


--
Daniel Koepke -:- dkoepke@california.com -:-  [Shadowlord/Nether]
Think.


     +------------------------------------------------------------+
     | 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