Re: a problem in index_boot

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 02/18/98


On Wed, 18 Feb 1998, Angus Mezick wrote:

->     I am really suprised that gcc doesn't report this on a SGI Indy but
->     index is a function in the string library.  it is a duplicate of
->     strchr.  i have rename all indexes to ?index (findex, gindex) where
->     appropriate. I am suprised that -Wshadow doesn't catch this... argh.

-Wshadow catches when a local variable shadows another local variable.
I don't see the relation between two functionally equivalent functions
(heh, relation and function...get it?  Bah, math puns) and the
-Wshadow parameter.  BTW, just because two functions take the same
parameters and give the same result, doesn't mean they do it in the
same way.

  long my_pow_2(int p)
  {
    return (2 << (p-1));
  }

  long math_pow_2(int p)
  {
    return ((long)pow(2, p));
  }

They'll both return the same result, and they both take the same
argument, but I can be fairly certain that my_pow_2() is faster,
if only because it doesn't do a cast and a second function call.

-dak


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