Where is the implementation of strlen() in GCC?

后端 未结 10 1065
梦毁少年i
梦毁少年i 2021-02-04 01:21

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

10条回答
  •  隐瞒了意图╮
    2021-02-04 01:52

    Here's the bsd implementation

    size_t
    strlen(const char *str)
    {
            const char *s;
    
            for (s = str; *s; ++s)
                    ;
            return (s - str);
    }
    

提交回复
热议问题