This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Two similar functions optimized differently


Alfie wrote:
  While playing with variations on a simple string comparing function,
I discovered that gcc will inline tolower differently for what appear
to be two almost identical functions.

gcc doesn't do any inlining of tolower. tolower is a macro defined by glibc.


  In the second (faster) function, gcc will compile the code to call
__ctype_tolower_loc only once, which it then stores for later use.

You need to include <ctype.h> to get the __ctype_tolower_loc calls. This was left out of your example.


When I try this with mainline (3.5) sources I get the desired result, so it looks like this has already been fixed.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]