This is the mail archive of the
mailing list for the GCC project.
Re: Two similar functions optimized differently
- From: Jim Wilson <wilson at specifixinc dot com>
- To: Alfie <alfie at leaflock dot homeip dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 25 Jun 2004 20:24:22 -0700
- Subject: Re: Two similar functions optimized differently
- References: <20040619190927.GA23639@leaflock.homeip.net>
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
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