Subject: Re: ktr from freebsd
To: None <tech-kern@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-kern
Date: 04/30/2004 10:00:30
On Thu, 29 Apr 2004, Jason Thorpe wrote:
> On Apr 29, 2004, at 4:03 PM, enami tsugutomo wrote:
> >The strlen call isn't folded to constant actually.
> 
> I'm pretty sure GCC 3.4 will do this, but I'm not sure GCC 3.3 will.

Here's something that should work in any compiler.  If you try to invoke
it with s not being a string literal, you get a syntax error.

#define literalstrlen(s) (sizeof("" s) - 1)

--apb (Alan Barrett)