In article <9f**********************************@k30g2000hse. googlegroups.com>,
Xia <ni******@gmail.comwrote:
>Is there a way(or where) I can see a certain C lib function, for
example atoi, is implemented? Thanks in advance.
There are several open source implementations of the standard C library
that you can look at. (See
<http://c-faq.com/resources/stdlibsrc.html>.)
Be warned that most of them do several of:
-Implement functions beyond the ones specified by the C standard
-Call non-standard functions to do some or all of the work
(for several standard library functions this is unavoidable)
-Use non-portable compiler extensions
-Use horribly ugly efficiency hacks
These are things that make sense for library implementors to do rather
more often than they make sense for user-programmers to do, so if your
intention is to learn how to write good code, you may be better off
looking at code other than implementations of the standard library.
Note also that the language defines the interface to and behavior of
the standard library functions, not the implementation. As long as it
meets the requirements imposed on it by the specification, the way your
implementation's standard library works may be entirely different from
the one you're looking at.
dave
--
Dave Vandervies dj3vande at eskimo dot com
I think it's obvious that pretty != fit for purpose. Except that, I suppose,
in this case pretty *is* the purpose, and rideability is relatively
unimportant. --Eric Schwartz in the scary devil monastery