Videos
Factsheet
Obtaining glibc code can be done via apt-get command. Here's basic process done in terminal, which takes no longer than 5 mins:
- Create
glibc-sourcedirectory withmkdir glibc-sourceandcd glibc-source - run
apt-get source glibc - Once
apt-getis done, you'll have 3 files and one directory,glibc-2.23/,glibc_2.23-0ubuntu3.dsc,glibc_2.23-0ubuntu3.debian.tar.xz,glibc_2.23.orig.tar.xz. The file you want isglibc-2.23/stdlib/atoi.c
Actually found it in the git repo here: https://github.com/lattera/glibc/search?utf8=%E2%9C%93&q=atoi&type=
Leaving this here to help anyone else who might wonder this in the future.
Out of curiosity, I really want to dig into the source code implementation of various C features like how is int, function, switch, ... implemented by C. Can you help me get started and point to where the actual source code is located so I can try to understand it?
Also, I want to know if the functions defined by the header files like math.h, stdio.h, ... are actually implemented by C or are they implemented by the compiler (gcc/clang). And where to locate the source code of these? (like where to find source code of qsort for example)
Are there any resources for learning about the internals of the language at this depth (other than the actual source code)?
And, it would really help me if you can expand the answer for the above questions to C++ also. For example, in C++ string contains the actual character array and the length of the array. But where to find the source code of string to see all the things that string does internally.