lkml.org 
[lkml]   [2002]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [TRIVIAL] strlen("literal string") -> (sizeof("literal string")-1)
On Thu, Aug 29, 2002 at 09:39:14AM -0600, Thunder from the hill wrote:

> > #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.

Sure the macro is fugly, but the code that uses it becomes
cleaner which was the whole point here.

Dave

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:28    [W:0.374 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site