views:

127

answers:

2

In C89 there're 15 header files:

<assert.h>  <locale.h>  <stddef.h>  <ctype.h>  <math.h>
<stdio.h>  <errno.h>  <setjmp.h>  <stdlib.h>  <float.h>
<signal.h>  <string.h>  <limits.h>  <stdarg.h>  <time.h>

What about the c++ standard?

+8  A: 

33 C++-specific ones:

<algorithm>    <iomanip>    <list>      <queue>       <streambuf>
<bitset>       <ios>        <locale>    <set>         <string>
<complex>      <iosfwd>     <map>       <sstream>     <typeinfo>
<deque>        <iostream>   <memory>    <stack>       <utility>
<exception>    <istream>    <new>       <stdexcept>   <valarray>
<fstream>      <iterator>   <numeric>   <strstream>   <vector>
<functional>   <limits>     <ostream>

Plus the 18 borrowed from C:

<cassert> <ciso646> <csetjmp> <cstdio>  <ctime>
<cctype>  <climits> <csignal> <cstdlib> <cwchar>
<cerrno>  <clocale> <cstdarg> <cstring> <cwctype>
<cfloat>  <cmath>   <cstddef>

(<iso646.h>, <wchar.h>, and <wctype.h> were added to the C standard in 1995)

Michael Burr
Can you elaborate how is `wchar.h` converted to `cwchar` ? Just rename it?
tem
The borrowed headers are the same as C except that the names are put into namespace `std` and "except as noted" by the library portion of the C++ standard. Exceptions are things like indicating that `offsetof` is defined to work only on POD types, etc. For pretty much all intents, the C library is brought into C++ as-is.
Michael Burr
+1 nice, I didn't know there were so few :)
KennyCason
I think an important "except as noted" moment is that `cmath` contains all those overloads not found in the C's `math.h`.
Cubbi
@tem: the 18 C++ headers 'borrowed' from C will come with your C++ compiler. You shouldn't have to do anything special to get `cwchar`.
Michael Burr
A: 

The standard does not specify that the standard headers are even implemented as files at all. Take, <iostream>for example: this need not correspond to a file on disc (as hinted at by the lack of .h file name extension). Any appropriate (where appropriateness is determined by the vendor) persistence mechanism may be employed. Furthermore, any library vendor may choose to break up the headers into arbitrary subunits in any way that he sees fit as long as the same interface is exposed.

Richard Cook
In C there're c89 and c99,what about c++? Is there any upgrade since it comes out?
tem