Mail Archives: djgpp/2000/06/05/21:45:37
From: | paul DOT bibbings AT tesco DOT net (Paul Bibbings)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Problem with DJGPP implementation of namespaces?
|
Date: | Tue, 06 Jun 2000 01:37:45 GMT
|
Organization: | Tesco ISP
|
Lines: | 71
|
Message-ID: | <393c50ca.34140115@news.tesco.net>
|
NNTP-Posting-Host: | 212.140.70.175
|
X-Newsreader: | Forte Free Agent 1.21/32.243
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
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.
//#define __BORLAND
#ifdef __BORLAND
#include <iostream.h>
#include <ctype.h>
#else
#include <iostream>
#include <cctype>
#endif
int main()
{
using std::cout;
char ch = 'r';
if(std::isdigit(ch)) // parse error before '('
cout << "Character " << ch << " is a digit." << endl;
else
cout << "Character " << ch << " is NOT a digit." << endl;
return 0;
}
However, if I alter this to
int main()
{
using std::isdigit;
//
if(isdigit(ch))
//
}
then there is no problem. And that's the inconsistency, because as the
second case shows, there doesn't seem to be a problem with accessing
isdigit via the std namespace, only with the specific way in which
this is done.
Note also that there is no similar difficultly with other std
functions such as either
using std::strlen;
int length = strlen(a_string);
or
int length = std::strlen(a_string);
What, then, is going on here, or what am I missing perhaps?
thanks for any comments,
Paul
- Raw text -