delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/16/03:06:33

Message-Id: <3.0.1.32.20010516150902.00717460@wingate>
X-Sender: n_abing#ns DOT roxas-online DOT net DOT ph AT wingate
X-Mailer: Windows Eudora Pro Version 3.0.1 (32)
Date: Wed, 16 May 2001 15:09:02 +0800
To: djgpp AT delorie DOT com
From: "Nimrod A. Abing" <n_abing AT ns DOT roxas-online DOT net DOT ph>
Subject: Re: #include <... .h > is bad ?
In-Reply-To: <1g14gt8nr64eoef3k0oo7tk8uurd4bdk0b@4ax.com>
References: <9dset2$oar$1 AT info DOT cyf-kr DOT edu DOT pl>
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

At 04:54 AM 05/16/2001 GMT, you wrote:
>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 ?

DJGPP supports it Right Now. The following works with gcc2952.zip,
gpp2952.zip, djdev203.zip installed:

c:\programs\djgpp\> cat > test.cc
#include <cstdlib>
#include <iostream>

int main(void)
{
	cout << "Hello there!" << endl;
	exit(0);
}
^Z

c:\programs\djgpp\> gpp -o test.exe test.cc

This is what's in DJDIR/lang/cxx/iostream

// -*- C++ -*- forwarding header.
// This file is part of the GNU ANSI C++ Library.

#ifndef __IOSTREAM__
#define __IOSTREAM__
#include <iostream.h>
#endif

As you can see, it just includes iostream.h. What they probably (on
c.l.c++) mean is ``using C++ header files with .h extensions, such as
iostream.h, is deprecated.'' This is not a compiler issue, rather it
depends on which C++ Standard Library you have installed. The one that
comes with DJGPP is the SGI STL, which as you can see works around this
``standard header names'' issue.

If you want to write portable C++ apps though, I recommend reading the C++
portability guide in Mozilla.org
<http://www.mozilla.org/hacking/portable-cpp.html>. FWIW, there seems to be
*no* fully compliant C++ compiler right now so you're better off following
Mozilla's guide if you want to be sure your C++ programs will compile under
different compilers.

>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.

<rant>
If only Bjarne Stroustrup would stop adding new subtle and next to minor
twiddles to his ``baby'' everytime he comes up with them, then maybe the
standards committee and the compiler vendors would not have such a
difficult time implementing C++.
</rant>

>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.

BTW, unless you say -fhonor-std at the gpp command line, gpp ignores the
std namespace.


- Raw text -


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