This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Speed-up get_identifier("main")
> On Wed, 06 Aug 2003 18:19:30 -0400, Jason Merrill <jason@redhat.com>
> wrote:
>
> > Could we use __builtin_constant_p to do this transformation transparently,
> > i.e.
> >
> > #define get_identifier(STR) \
> > __builtin_constant_p (STR) \
> > ? get_identifier_with_length (STR, (unsigned) (STR)) \
> ^strlen, oops
> > : (get_identifier) (STR)
>
> Jason
Cosmetic nit, I believe there are two historical idioms used here that
we no longer need.
The cast to unsigned of the strlen was only necessary when prototypes
were missing in traditional C. The parens around get_identifier were
only necessary to prevent macro recursion in traditional cpp.
Neither issue arises anymore since we've required ISO C.
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu