__builtin_string_constant_p

Florian Weimer fw@deneb.enyo.de
Tue Aug 10 22:23:00 GMT 2004


For some routines that should only accept string literals, it would be
nice to have a __builtin_string_constant_p built-in.  For example,
given

inline int foo(const char* p)
{
  return __builtin_string_constant_p(p);
}

the expression

  foo("bar")

shall evaluate to 1.

Adding it in parallel to __builtin_constant_p doesn't seem to work,
even if I use c_strlen().  The behavior is similar to
__builtin_constant_p, i.e. the macro case is not handled as expected.



More information about the Gcc mailing list