delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/16/01:00:14

From: Jack Klein <jackklein AT spamcop DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: #include <... .h > is bad ?
Message-ID: <1g14gt8nr64eoef3k0oo7tk8uurd4bdk0b@4ax.com>
References: <9dset2$oar$1 AT info DOT cyf-kr DOT edu DOT pl>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Lines: 46
Date: Wed, 16 May 2001 04:54:36 GMT
NNTP-Posting-Host: 12.84.10.13
X-Complaints-To: abuse AT worldnet DOT att DOT net
X-Trace: bgtnsc06-news.ops.worldnet.att.net 989988876 12.84.10.13 (Wed, 16 May 2001 04:54:36 GMT)
NNTP-Posting-Date: Wed, 16 May 2001 04:54:36 GMT
Organization: AT&T Worldnet
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Wed, 16 May 2001 01:43:46 +0200, "Rafal Maj"
<maj_rafal AT poczta DOT onet DOT pl> wrote in comp.os.msdos.djgpp:

> Hi,
> on comp.lang.c++ all users ara saying, that writting for example :
> #include <iostream.h>
> is an error, and I should use
> #include <iostream>
> When will DJGPP support this ? Have it something to do with GCC 3.0 ?
> Raf256

The very first ever ANSI/ISO International Standard for C++ was
ratified in September 1999.  This change was made for two reasons:

There was no standard naming convention for headers on C++ systems.
Most used .h, just like C headers, but others used variations like
.hpp or .hxx, so defining one suffix in the standard would break at
least some code on some compilers.

The second reason is that some of the library functions and features
changed as the language developed, and some functions and classes are
different than they originally were.  And finally namespaces were
added to C++.

So the standard committee defined all of the new, standard conforming
C++ headers without any extension at all.  They place all of the
types, templates, and functions in the namespace std (and some
namespaces nested inside std) instead of in the global namespace.

This also allows compiler vendors to supply versions of the headers
with the .h extensions that work the old way, for their customers who
do not want to rewrite their code right away or maybe ever, although
this is not required by the standard.

Finally the C++ standard provides two different ways to use standard C
library headers:  as before with the .h (like stdio.h, string.h,
time.h), or removing the .h but adding the letter 'c' in front
(cstdio, cstring, ctime).

gcc 2.95.x and 2.96.x do not fully support this feature of C++ and do
not fully support namespaces.  This support is supposed to be much
improved in gcc 3.0.

-- 
Jack Klein
Home: http://JK-Technology.Com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019