This may be a ridiculous question, but it seems like a reasonable one to me... I often open up source files and see various system header files included and wonder what each of them are. I know what the likes of stdio.h
and sys\types.h
are for, but there are others that I'm not too sure about. Is there someplace that gives a list of standard header files and a description of their purpose (and details given per OS, language standard)? Maybe this list would also include definitions included in said header files, macros, etc. Something organised by topic would be helpful, too.

- 8,095
- 5
- 36
- 53
-
@kichik, I have. A Google query returns things like [this StackOverflow question](http://stackoverflow.com/questions/2027991/list-of-standard-header-files-in-c-and-c), the [Wikipedia entry](http://en.wikipedia.org/wiki/C_standard_library) cited by several other answers, and a few other hits--none of which answer my question. The hit for the relevant O'Reilly _C in a Nutshell_ section seem to fit the bill, but I'm looking for an online resource. – GarlicFries Aug 20 '11 at 01:19
-
Would information limited to, say, POSIX and Windows systems be sufficient, or do you want to cover more exotic systems as well? – Keith Thompson Nov 15 '11 at 11:12
-
I'm most interested in Mac--and I do mean Mac (as opposed to just plain POSIX). There seem to be a heap of Mac-specific header files beyond or alongside the POSIX-standard files. – GarlicFries Nov 15 '11 at 11:23
5 Answers
For language-defined headers, the library section (section 7) of the C standard (PDF) is definitive. There's a subsection for each header, though <limits.h>
and <float.h>
are described in 5.2.4.2.
POSIX is here; access is free, but you have to sign up for an account. (I'm actually not 100% sure of the relationship among POSIX, SUS, and IEEE Std 1003.1.)
EDIT :
Mac OSX man pages are available here.
But consider that you might be approaching this from the wrong direction. When writing code, a better approach is typically to (a) decide what you want to do, (b) find a function that will do it, and (c) read the function's documentation to determine which header you need to #include
. A given header doesn't necessarily have a coherent meaning.

- 254,901
- 44
- 429
- 631
-
This is yet closer to what I seek, yet still not exactly it. Nothing regarding OS-specific readers there, and for obvious reasons. I guess I'm really asking if something like headerfiles.com exists... ;) – GarlicFries Aug 20 '11 at 06:58
-
Any OS in particular? If you're looking for Windows, msdn.microsoft.com is probably a good place to start. – Keith Thompson Aug 20 '11 at 07:14
-
I'm interested in various *nix flavours and Mac OS X. Wouldn't touch Windows with a ten-foot pole, but I'm sure there are some who would be interested. – GarlicFries Aug 20 '11 at 07:55
-
I actually wasn't sure about the POSIX/SUS/IEEE 1003.1 relationship either. [This](http://en.wikipedia.org/wiki/Single_UNIX_Specification) sums it up nicely. – GarlicFries Aug 20 '11 at 08:03
-
Maybe I'm just OCD... ;) I know about the differing opinions around accepting answers for reasons other than the obvious, but that's not really the problem here. This is one of the issues with SO (and a conversation that occurs frequently on meta)--this question has received 5 answers, several upvoted, but none that completely answer my question. Pile up a few of those while you wait eternally for new answers, and that 94% continues to drop further and further... – GarlicFries Nov 15 '11 at 11:21
-
-
thanks for fleshing that out! FWIW, regarding your final comments, my reason for wondering was when looking at existing code, not code I am in the process of writing. Thanks, again. – GarlicFries Nov 15 '11 at 21:57
Hopefully this is along th lines of what you were looking for:

- 4,994
- 2
- 24
- 37
-
Yes, _along_ the lines of what I want, but doesn't include POSIX library headers, etc. I understand that there is a link to this information, but I'm interested in a reference that actually pulls everything together... – GarlicFries Aug 20 '11 at 01:15
-
I don't think you will find such a reference on the net right now. But maybe someone get inspired by our question and creates one ;) – Thomas Berger Aug 20 '11 at 01:22
Here's one for C:

- 41,484
- 20
- 104
- 125
-
This does not include the os specific ones, or have i missed them in the index? – Thomas Berger Aug 20 '11 at 01:10
-
So far, this is the closest answer to my question, but presents only a subset of the headers in which I am interested. Note that I am not only asking abou the ISO standard library, but _standard system headers_--anything that `#include
`... – GarlicFries Aug 20 '11 at 01:24 -
@Thomas: there can be a lot of OS specific ones, sometimes a few hundred, and they seem to change every now and then. I doubt you will find a listing of those, except in the documentation for the OS SDKs. – Rudy Velthuis Aug 20 '11 at 04:05
One way is to look inside the header file. Many files have good comments. Under unix systems you could use the manpage: man stdint.h
p.a.

- 1,860
- 13
- 26
-
-
The header files themselves tend to contain a lot of system-specific stuff, which can obscure the portable stuff you're really looking for. – Keith Thompson Aug 20 '11 at 01:29
-
@Keith From the question: *(and details given per OS, language standard)* – Thomas Berger Aug 20 '11 at 01:34