This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: C-string length at compile time
- From: Wei Qin <wqin at EE dot Princeton dot EDU>
- To: Sebastian Huber <sebastian-huber at web dot de>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 30 Aug 2002 15:21:41 -0400 (EDT)
- Subject: Re: C-string length at compile time
You can use sizeof() instead of strlen(). It will resolve at compile time.
Wei
On Fri, 30 Aug 2002, Sebastian Huber wrote:
> Hallo,
> is it possible to get the length of a C-string at compile time? I have various
> #define CSTRING "blabla"
> in combination with 'strlen( CSTRING)'. Or is maybe strlen() evaluated from
> the compiler if I switch the optimization on?
>
> Ciao
>