Re: how is strcmp implemented so efficiently?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reza Roboubi <reza@xxxxxxxxxx> writes:

> I noticed that strcmp is extremely smart.  It knows when one parameter
> has constant length, determined at compile time.  In that case it
> reverts to an inline version of the x86 string commands.
>
> I looked into the headers and strcmp is defined as an extern(not inline.)
>
> How would I ever write such an efficient function?  Is it
> possible(even _with_ the use of asm?!)

The compiler automatically recognizes strcmp when compiling C/C++
code, among many other builtin functions.  See the docs for the
complete list.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux