This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]