Re: [TRIVIAL] strlen("literal string") -> (sizeof("literal string")-1)

Thunder from the hill
2002-08-29T15:35:39Z

Hi,

On Thu, 29 Aug 2002, Rusty Russell wrote:
> If you really care about that, try:
>
> /* Be paranoid in case someone uses strlen(&("FOO"[0])) */
> #define strlen(x) \
> (__builtin_constant_p(x) && sizeof(x) != sizeof(char *)
> ? (sizeof(x) - 1) : __strlen(x))

I must say that doesn't make the code any cleaner, which leads to it being
not as clean as Keith suggested. It was a code cleanup, not a code messup.

Thunder
--
--./../...-/. -.--/---/..-/.-./..././.-../..-. .---/..-/.../- .-
--/../-./..-/-/./--..-- ../.----./.-../.-.. --./../...-/. -.--/---/..-
.- -/---/--/---/.-./.-./---/.--/.-.-.-
--./.-/-.../.-./.././.-../.-.-.-