473,394 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

C lib functions

Xia
Is there a way(or where) I can see a certain C lib function, for
example atoi, is implemented? Thanks in advance.
Xia
Jun 27 '08 #1
5 1336
On May 30, 1:37 am, Xia <ningx...@gmail.comwrote:
Is there a way(or where) I can see a certain C lib function, for
example atoi, is implemented? Thanks in advance.
Xia
If your implementation is open-source, you can.
(such as glibc; <http://www.gnu.org/software/libc/libc.html>)
There's also an excellent book by P.J. Plauger, "The Standard C
Library", which has a complete implementation of a standard C library.
K&R2 has an implementation of atoi in 2.7
Jun 27 '08 #2
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
Jun 27 '08 #3
Xia wrote:
Is there a way(or where) I can see a certain C lib function, for
example atoi, is implemented? Thanks in advance.
Xia
you mean "how" it is implemented or "whether on your system" is implemented?

Sorry, can't understand your question.

--
Pietro Cerutti
Jun 27 '08 #4
On May 29, 3:37*pm, Xia <ningx...@gmail.comwrote:
Is there a way(or where) I can see a certain C lib function, for
example atoi, is implemented? Thanks in advance.
It's a FAQ:
18.13: Where can I find the sources of the standard C libraries?

A: The GNU project has a complete implementation at
http://www.gnu.org/software/libc/. Another source (though not
public domain) is _The Standard C Library_, by P.J. Plauger
(see
the Bibliography). See also questions 18.9b, 18.15c, and
18.16.

Also, the Microsoft compiler comes with source for the library.
The Watcom C compiler has an open source library.

Often, C library functions are not written in C but (rather) in
assembly language.

Jun 27 '08 #5
On Thu, 29 May 2008 15:37:31 -0700, Xia wrote:
Is there a way(or where) I can see a certain C lib function, for example
atoi, is implemented? Thanks in advance. Xia
If you want to see how a particular standard library function is
implemented then, as it has already been stated before, you only need to
get your hands on any open source standard library and just dig in.

If, on the other hand, you need to check if a certain function is
available on your system then you can always adopt the ./configure script
approach, which is to try to compile some minimalist test code that uses
that particular function and check if the compilation fails or not.
Hope this helps
Rui Maciel
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: hokiegal99 | last post by:
A few questions about the following code. How would I "wrap" this in a function, and do I need to? Also, how can I make the code smart enough to realize that when a file has 2 or more bad...
99
by: David MacQuigg | last post by:
I'm not getting any feedback on the most important benefit in my proposed "Ideas for Python 3" thread - the unification of methods and functions. Perhaps it was buried among too many other less...
21
by: Rubén Campos | last post by:
I haven't found any previous message related to what I'm going to ask here, but accept my anticipated excuses if I'm wrong. I want to ask about the real usefulness of the 'inline' keyword. I've...
17
by: cwdjrxyz | last post by:
Javascript has a very small math function list. However there is no reason that this list can not be extended greatly. Speed is not an issue, unless you nest complicated calculations several levels...
2
by: Bryan Olson | last post by:
The current Python standard library provides two cryptographic hash functions: MD5 and SHA-1 . The authors of MD5 originally stated: It is conjectured that it is computationally infeasible to...
7
by: Tim ffitch | last post by:
Hi I have created a VB dll file that contains common functions I use across various projects in VB, Access and Excel. Rather than have to code the functions in each I decided to use the dll...
23
by: Timothy Madden | last post by:
Hello all. I program C++ since a lot of time now and I still don't know this simple thing: what's the problem with local functions so they are not part of C++ ? There surely are many people...
14
by: v4vijayakumar | last post by:
Why we need "virtual private member functions"? Why it is not an (compile time) error?
7
by: Immortal Nephi | last post by:
My project grows large when I put too many member functions into one class. The header file and source code file will have approximately 50,000 lines when one class contains thousand member...
6
KevinADC
by: KevinADC | last post by:
This snippet of code provides several examples of programming techniques that can be applied to most programs. using hashes to create unique results static variable recursive function...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.