Where is the implementation of strlen() in GCC?

Chris Tonkinson picture Chris Tonkinson · Nov 14, 2009 · Viewed 54.1k times · Source

Can anyone point me to the definition of strlen() in GCC? I've been grepping release 4.4.2 for about a half hour now (while Googling like crazy) and I can't seem to find where strlen() is actually implemented.

Answer

Mark Rushakoff picture Mark Rushakoff · Nov 14, 2009

You should be looking in glibc, not GCC -- it seems to be defined in strlen.c -- here's a link to strlen.c for glibc version 2.7... And here is a link to the glibc SVN repository online for strlen.c.

The reason you should be looking at glibc and not gcc is:

The GNU C library is used as the C library in the GNU system and most systems with the Linux kernel.