Thread: Source code of the standard library functions...

  1. #1
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020

    Source code of the standard library functions...

    Hi,

    Is it possible to view the source code of the standard c library functions? Like viewing the source code of printf() would be cool. IF so, how to do it?

    thnx

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    I don't know this, but I assume that the source code for your compiler is actually a mix of macros and assembly. Most of the stuff can be implemented in C, but it's just a need for speed kinda thing. Still, the source is out there... I think that DJGPP is open source.

    How printf works is something of a special case, since it uses a variable length argument list.

    Understanding how the functions work is something that I think K&R covers quite well. In fact, it has some interesting implementations at the end (fopen, getc, malloc, &ct).
    Callou collei we'll code the way
    Of prime numbers and pings!

  3. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    Yes, you can view the source code of the standard C library functions. GCC is open source, the source code can be downloaded from gcc.gnu.org.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seven Kingdoms I: Ancient Adversaries for Linux
    By MIH1406 in forum Projects and Job Recruitment
    Replies: 13
    Last Post: 01-17-2010, 05:03 PM
  2. exchange functions demo code
    By kryptkat in forum C++ Programming
    Replies: 0
    Last Post: 04-05-2009, 02:06 PM
  3. Search for patterns in source code
    By MiamiCuse in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 10-23-2005, 11:28 PM
  4. Links to learn standard C library functions...
    By Nutshell in forum C Programming
    Replies: 8
    Last Post: 02-01-2002, 12:41 AM
  5. C source code for int25 or code help
    By Unregistered in forum C Programming
    Replies: 0
    Last Post: 09-26-2001, 02:04 AM