#C Source Code

19 messages · Page 1 of 1 (latest)

violet dagger
#

I would like to know where can I find the function definitions ? Inbuilt function definition for example:

strlen() or strcmp() or strrev()

I did try to find it on gcc official website but it's hard to navigate through it so can someone please tell me where can I get the source codes of inbuilt library function. Definitions are in the header file string.h but can't find the file string.c with source codes

nimble sundialBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

spark dragon
#

do you want the source code of glibc? or any libc in general?

violet dagger
#

To be precise I want just the function definitions of the inbuilt library function if it is there in the glibc or libc then yes please I would like that

spark dragon
#

that doesn't really answer my question. there are more than one libc implementations out there. glibc is one of them.

regardless you can find the glibc impl for the above functions here https://github.com/bminor/glibc/tree/master/string though i strongly advise you look for the musl impl instead. it way more readbale

violet dagger
#

Yup it has resolved my issue thanks for this and sorry for not being able to answer your question accurately. Just been 15 days since learning C so I don't know much about it

#

!solved

nimble sundialBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

verbal cargo
#

Now, this is just the generic C version

spark dragon
#

Just been 15 days since learning C so I don't know much about it
why do you want to look into the libc source then?

verbal cargo
#

There are hand-vectorized implementations too which this tool can also help locate

#

If you are super new to C I would caution that libc code can be pretty dense and not particularly well-written

violet dagger
spark dragon
violet dagger
#

I will try to understand but ya thanks for the source codes

spark dragon
#

i feel obligated to recommend musl's source code intsead

violet dagger