Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: All
Jun 17, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Standard Headers' Names

All Standard C++ header files must be included in the following way:
#include <iostream> //note: no ".h" extension
//...other #include statements
That is, the ".h" extension should not be used. This technique applies to a subset of standard C header files as well, with the addition of the letter 'c' affixed to their name. So a C standard header formerly named <xxx.h> is now <cxxx>. For example:
#include <cassert> //formerly: <assert.h>  mind the prefix 'c' and the omission of  ".h"
The older convention for C headers, <xxx.h>, is still supported but is now considered deprecated and should not be used. The problem is that C <xxx.h> headers would inject their declarations into the global namespace. In C++ most standard declarations are grouped under namespace std and so are the <cxxx.h> Standard C headers. This eliminates the name conflict problem which can occur when global declarations are used. Keep in mind that you need to use a using declaration or a using directive in order to access the declarations in the standard headers:
#include <cstdio> 
using namespace std; //this is a using directive

void f()
	printf ("Hello World\n");
Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date