This is the mail archive of the gcc-patches@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: [PATCH] Speed-up get_identifier("main")


On Thu, 7 Aug 2003, Kaveh R. Ghazi wrote:
>  > > #define get_identifier(STR) \
>  > >   __builtin_constant_p (STR) \
>  > >   ? get_identifier_with_length (STR, (unsigned) (STR)) \
>  >                                                  ^strlen, oops
>  > >   : (get_identifier) (STR)
>  >
>  > Jason
>
> The cast to unsigned of the strlen was only necessary when prototypes
> were missing in traditional C.

I've kept the explicit cast to (unsigned int) in the latest version of
my patch.  Many compilers issue warnings about implicit loss of precision
converting the size_t returned by strlen into the unsigned int required
by the prototype.  Whilst an explicit cast isn't required, it helps
silence compiler warnings from non-GCC host compilers.

At some point in the future, we may even enable such portability warnings
by default during GCC bootstraps.

Roger
--


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