Re: Sources for functions like malloc()
From: William Ahern (william_at_wilbur.25thandClement.com)
Date: 07/06/04
- Next message: Keith Thompson: "Re: Accessing a global variable when there is a local variable in the same name"
- Previous message: Keith Thompson: "Re: Are there any Free C Standard Documents ?"
- In reply to: Blue Ocean: "Sources for functions like malloc()"
- Next in thread: Blue Ocean: "Re: Sources for functions like malloc()"
- Reply: Blue Ocean: "Re: Sources for functions like malloc()"
- Reply: LibraryUser: "Re: Sources for functions like malloc()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 6 Jul 2004 11:48:47 -0700
Blue Ocean <blueoceanz1@hotmail.com> wrote:
> Hey all, I have another question. I may seem like a moron here, but
> where can I find out how C-standard functions like malloc() and
> printf() are declared? I know that I can find on my computer their .h
> files, but I can't find the .c files anywhere. Are they already in
> object code or something? Can I disassemble them to see how they are
> written?
Aside from the previous corrections and suggestions (a good book can be
invaluable), the OpenBSD sources (and I'm sure NetBSD) are pretty clean-cut:
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/
If you dive into GCC or glibc you might drown. You can get lost in the
assembly, I18N, SYSV & POSIX.2 & BSD emulation, Linux'isms, etc.
Keep in mind that the internals of malloc(), printf() and the like can
differ widely; you can easily screw yourself by getting chummy w/ them. Keep
a copy of the ISO C standard at hand to stay afloat.
Even better than looking at other sources is trying to emulate the behavior
of the above w/o peeking at what others did. Seeing somebody's answers can
undermine your ability to truly understand the problem(s) and to be readily
able to imagine alternatives.
- Next message: Keith Thompson: "Re: Accessing a global variable when there is a local variable in the same name"
- Previous message: Keith Thompson: "Re: Are there any Free C Standard Documents ?"
- In reply to: Blue Ocean: "Sources for functions like malloc()"
- Next in thread: Blue Ocean: "Re: Sources for functions like malloc()"
- Reply: Blue Ocean: "Re: Sources for functions like malloc()"
- Reply: LibraryUser: "Re: Sources for functions like malloc()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|