Difference and Histroy about inluding of header without h

R

Rainer Heynke

Hi,

a friend of mine ask about the reason and the history beyond the two
different ways to include std-headers like

#include "stdio.h"
#include <cstdio>


He's no using the usenet, but he read the answers via google.




Rainer
 
J

James Kanze

Before C++ became an ISO standard, there were already many C++
headers like iostream.h and similar, whose functionality
differed from one compiler to another.

Actually, the functionality differed less than the names. Some
compilers had <iostream.h>, <strstream.h>, etc.; others
<iostream.hpp>, <strstrea.hpp>, etc.; and who knows what else.
 
J

James Kanze

Standard headers are never included with quotes, always with
angle brackets. So, you shouldn't at all see
#include "stdio.h"
but always
#include <stdio.h>
. As to the presence of '.h', it's specific to C. Standard
C++ headers do not have '.h' in them.

Both <stdio.h> and <cstdio> are part of standard C++. Based on
the C++03 standard, very few compilers actuallly implement
<cstdio> correctly, however, so it's probably best to avoid it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top