std Namespace
#include"include-file-name"
#include<include-file-name>
< > and "" have different search paths.
< > usually searches system directories; " " doesn't.
-I options for g++ and CC.
#ifndef idiom for include files.
#ifndef _includefile_h_ #define _includefile_h_ // Included material here. #endif
.h, .hh, .H, .hxx
.h
.h standard includes.
<string> is not <string.h> is not <cstring>
/ vs. \.
std Namespacestd
namespace.
std::.
using declarations make this less cumbersome.
std:: or explicitly eliminate it.
using namespace.
<iostream>, <iomanip>, <fstream>
<vector>, <list>, <map>, <iterator>,
<algorithm>, <utility>, <queue>, <stack>,
<deque>, <set>, <bitset>, <functional>,
<memory>
<exception>, <stdexcept>
<string>, <sstream>
<locale>, <limits>, <typeinfo>
std namespace, sometimes.
.h and prepend a 'c'.
assert.h, use
#include <cassert>
.h forms from C++ is nonstandard.
c-prepended headers make the proper C++ extern declarations,
.h headers do not.
<cassert>.
assert((0 <= i) and (i < N));
assert()'s a macro, no std::.
<cctype>.
ch = std::toupper(ch);
<cmath>.
double x = std::log(M_PI);
M_PI is a macro, log() is a function; std::M_PI doesn't compile.
<climits>.
std::cout << "Biggest possible int is << INT_MAX << "\n";
std::INT_MAX doesn't compile either.
<ctime>.
strcasecmp(), strings.h, X Window System includes.
.cc) files, but the STL does.
c prefix.
This page last modified on 10 September 2002.