delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/06/02:29:43

Message-ID: <20000606062607.58991.qmail@hotmail.com>
X-Originating-IP: [208.160.246.197]
From: "Nimrod Abing" <n_abing AT hotmail DOT com>
To: djgpp AT delorie DOT com
Subject: Re: Problem with DJGPP implementation of namespaces?
Date: Tue, 06 Jun 2000 14:26:07 PHT
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

>From: paul DOT bibbings AT tesco DOT net (Paul Bibbings)
>Reply-To: djgpp AT delorie DOT com
>To: djgpp AT delorie DOT com
>Subject: Problem with DJGPP implementation of namespaces?
>Date: Tue, 06 Jun 2000 01:37:45 GMT
>
>I have used the following short program to investigate in a simple
>form a problem I've been having with calling isdigit() from the std
>namespace in DJGPP. Okay, I am not a seasoned C++ programmer, but
>there seems to be an inconsistency in the way in which DJGPP will
>accept use of isdigit().
>	So, the following, which compiles without errors using
>Borlands C++ compiler BCC 5.5, fails in DJGPP with the single error as
>indicated.
>

[SNIP]

Instead of using the syntax ``std::func_name()'', why not declare

using namespace std;

right after your #include and other directives and right before the
spot where you intend to use functions, structs, enums, typedefs, and
classes belonging to the ``std'' namespace. The Gnu C compiler 2.952 and
earlier versions, by default, ignores the ``std'' namespace. In fact,
you can ignore the std namespace altogether when you use gcc or gxx. But
this works only for std namespaces, with other namespaces, you have to
use the ``using'' directive or :: scope resolution operator.

Using ``using namespace std;'' also makes your source cleaner since you
do not have to include the ``std::'' scope resolution everytime you use
something from the std namespace.


----------------
_nimrod_a_abing_


------------------------------------------
Homepage: http://www.geocities.com/n_abing


________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

- Raw text -


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