Re: a problem in index_boot

From: Angus Mezick (angus@EDGIL.CCMAIL.COMPUSERVE.COM)
Date: 02/18/98


     ya missed the point.... index is being used as a variable in the code
     and is a function in the strings.h package. kinda like when someone
     declares the variable number, but there is a number func in the circle
     code.
     --Angus


______________________________ Forward Header __________________________________
Subject: Re:  a problem in index_boot
Author:  INTERNET:CIRCLE@POST.QUEENSU.CA at CSERVE
Date:    2/18/98 2:24 PM

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