delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/28/15:13:11

From: "Tim \"Zastai\" Van Holder" <zastai AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <393c50ca DOT 34140115 AT news DOT tesco DOT net>
Subject: Re: Problem with DJGPP implementation of namespaces?
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <0nr65.110842$6t3.155540@afrodite.telenet-ops.be>
Date: Wed, 28 Jun 2000 18:21:48 GMT
NNTP-Posting-Host: 213.224.63.5
X-Complaints-To: abuse AT pandora DOT be
X-Trace: afrodite.telenet-ops.be 962216508 213.224.63.5 (Wed, 28 Jun 2000 20:21:48 MET DST)
NNTP-Posting-Date: Wed, 28 Jun 2000 20:21:48 MET DST
Organization: Pandora-- Met vlotte tred op Internet
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Paul Bibbings <paul DOT bibbings AT tesco DOT net> wrote in message
news:<393c50ca DOT 34140115 AT news DOT tesco DOT net>...
> 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().

You're right, there is some inconsistency in which GCC handles the 'std'
namespace. In fact, by default, it doesn't handle the 'std' namespace at
all; only if the -fhonor-std flag is given will 'std' actually be used (and
if you use -fhonor-std, you must also have used that flag for EVRY library
used by gcc, including libgcc). I suspect there is a bug in gcc relating to
this (it translates std::foo to ::foo, and using ::isdigit also fails, which
it certainly shouldn't).
As to why strlen DOES work, I believe strlen is a builtin for gcc 2.95 (and
possibly 2.8.1 as well); see gcc/c-decl.c in the gcc sources. As such, gcc
would probably ignore the namespace prefix and use its builtin instead.
In any case, the usual behaviour in regular sources using C++ is to put a
'using namespace std;' after all includes, and overriding scoping when
required (ie rarely). The only exception would pobably be if you have a
namespace replacing may symbols from namespace std.

Zastai



- Raw text -


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