This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C headers and std namespace


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have some code which I am moving from libstdc++-2 to libstdc++-3.
In order to eliminate the need for putting std:: in front of
everything, I am putting "using namespace std" at the top of each
source file.

However, some C library functions (notably those from ctype.h) are
now causing clashes because they are included in the global namespace
AND namespace std.

I am using the new C++-style header <cctype>

e.g.

#include <cctype>

using namespace std;

int main()
{
  bool x=false;

  if(isdigit('1'))
    x=true;

  return 0;
}

Ambiguous call to isdigit(char&):
options are:
isdigit(int)
std::isdigit(int)

Anthony

alink@anthonyw.cjb.net -- Questions relating to ALINK
anthony@anthonyw.cjb.net  -- Non-ALINK questions
http://anthonyw.cjb.net/ -- ALINK home page
PGP Fingerprint: 
0E2D D32A 8732 DC31 804C  D435 9BF0 F8FE 1C1B 9AD5
PGP Key at: http://i3.yimg.com/3/c7e5ee24/g/68fc2307.asc

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.1 for non-commercial use <http://www.pgp.com>

iQA/AwUBOO3zS5vw+P4cG5rVEQIUwwCg/ThGEzMfxVQ+GS91k1LcyD5eqi4An2kQ
mb49wYIxqmJSvzT1ip7CRccu
=Sf6h
-----END PGP SIGNATURE-----



__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]