You are on page 1of 2

C++ General: What are C++ Headers? Q: What are traditional C++ (pre-standard) headers?

A: The traditional C++ (pre-standard) headers define classes, values, macros, and functions in headers that have *.h extension. This includes non-standard STL headers with *.h extension (iostream.h, fstream.h, vector.h, etc.) and C headers with *.h extension (stdlib.h, stdio.h, etc.). Pre-standard headers have all the code in the global namespace.

Q: What are C++ standard headers? A: C++ standard headers are those headers that are specified by the C++ standard.

Q: How do I recognize the C++ standard headers? A: The naming scheme for these files were specified based on the naming scheme of the traditional header files, but without the ending '.h'. For example, 'fstream.h' becomes 'fstream', 'memory.h' becomes 'memory' and so on.

Q: What about 'iostream.h'? A: The header iostream.h has never been part of the official C++ standard, which means any compiler that provides iostream.h, can do what ever it wants with it, and the compiler would still be considered compliant with the C++ standard. However, the C+ standard specifies the existence of a header within the input/output library.

Q: What about the traditional ANSI C standard header files? A: The traditional ANSI C standard header files are prefixed with the letter 'c'. Thus 'stdio.h' has become 'cstdio', 'stdlib.h' is called 'cstdlib', 'math.h' is called 'cmath', 'time.h' is called 'ctime' and so on. This is the complete list:  <assert.h> - <cassert>  <ctype.h> - <cctype>  <errno.h> - <cerrno>  <float.h> - <cfloat>  <iso646.h> - <ciso646>  <limits.h> - <climits>  <locale.h> - <clocale>  <math.h> - <cmath>  <setjmp.h> - <csetjmp>  <signal.h> - <csignal>  <stdarg.h> - <cstdarg>  <stddef.h> - <cstddef>  <stdio.h> - <cstdio>  <stdlib.h> - <cstdlib>  <string.h> - <cstring>  <time.h> - <ctime>  <wchar.h> - <cwchar>  <wtype.h> - <cwtype>

Q: Which are the C++ standard headers? A: Grouped on library category, here they are:  Language support:  Types: <cstddef>  Implementation properties: <limits>, <climits>, <cfloat>  Start and termination: <cstdlib>  Dynamic memory management: <new>  Type identification: <typeinfo>  Exception handling: <exception>  Other runtime support: <cstdarg>, <csetjmp>, <ctime>, <csignal>, <cstdlib>  Diagnostics:  Exception classes: <stdexcept>  Assertions: <cassert>  Error numbers: <cerrno>  General utilities:  Utility components: <utility>  Function objects: <functional>  Memory: <memory>  Date and time: <ctime>  Strings:  Character traits: <string>  String classes: <string>  Null-terminated sequence utilities: <cctype>, <cwctype>, <cstring>, <cwchar>, <cstdlib>  Localization:  Locales: <locale>  C library locales: <clocale>  Containers:  Sequences: <deque>, <list>, <queue>, <stack>, <vector>  Associative containers: <map>, <set>  Bitset: <bitset>  Iterators: <iterator>  Algorithms:  Non-modifying sequence operations: <algorithm>  C library algorithms: <cstdlib>  Numerics:  Complex numbers: <complex>  Numeric arrays: <valarray>  Generalized numeric operations: <numeric>  C library: <cmath>, <cstdlib>  Input/output:  Forward declarations: <iosfwd>  Standard iostream objects: <iostream>  Iostreams base classes: <ios>  Stream buffers: <streambuf>  Formatting and manipulators: <istream>, <ostream>, <iomanip>  String streams: <sstream>, <cstdlib>  File streams: <fstream>, <cstdio>, <cwchar>