[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: g++ linker error



On Thu, 14 Oct 1999, Wichert Akkerman wrote:
>Previously Stephen R. Gore wrote:
>> If you use '#include<iostream>', you must also use 'namespace std;' at the
>> end of the includes block.
>
>This is of course really bad codingstyle, as well as slightly incorrect.
>Including a complete namespace shouldn't be done if at all possible..
>
>> I can't comment on the correctness, but namespace std is the new standard.
>> New compilers support .h headers as a backward compatibility feature.
>
>Indeed. The .h headers don't put things in the std-namespace, which means
>you can possibly mess up your own namespace. Unfortunately at this moment
>libstdc++ doesn't support namespaces yet, so we'll have to wait until
>libstdc++v3 is released.

Below is my /usr/include/g++-3/iostream file (I am running the latest
Potato).  So at the moment it seems that there is no functional difference
between including <iostream> and <iostream.h>.
Also at the moment much of the code I work with is pre-ANSI C (such as the
password checking program for Qmail POP server).  The AIX compiler setup is
all pre-ANSI C (I am doing a fair bit of AIX work at the moment).  AIX is
also the only platform on which I've seen a compiler refuse to compile code
because it's C++!
Squid is all pre-ANSI C, and many open source programmers refuse to do C++
(I am just about to release my own fork of a popular program because the
original author won't do C++). I really doubt that we will see 1% of the code
in Debian using C++ name spaces within a few years.  In fact I would not
write any such code myself because it'll just make things difficult when
trying to merge in non-name space code.

// -*- C++ -*- forwarding header.
// This file is part of the GNU ANSI C++ Library.
 
#ifndef __IOSTREAM__
#define __IOSTREAM__
#include <iostream.h>
#endif

-- 
I'm in Utrecht.  I'd like to meet any Linux users in the area, or any other
part of the Netherlands.


Reply to: