This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: strlen() and constant folding
Bryan Christ wrote:
> Is there some way to tell gcc to behave in a way that would be
> analogous to constant folding when dealing with strlen() calls where
> the target is const char* type? If there is a macro or different
> directive that would accomplish the same, that would be okay for my
> purposes.
Works for me:
int poo(void)
{
return strlen("test");
}
poo:
movl $4, %eax
ret
Andrew.