This is the mail archive of the 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]

std C functions && namespace std;


  Ok, what's the deal with the following code? I expected the third 
use of toupper() to work, but when compiled, I get the complaint below 
(the prog). Should the call to unqualified toupper() work? or is this 
another "I've much more to learn" situation ;)


#include <iostream>
using namespace std;

  char a('a');
  cout.put(std::toupper(a));   // ok
  cout.put(::toupper(a));      // ok
  cout.put(toupper(a));        // causes the output below
  return 0;

speedy$ g++ -g -Wall -I. -o toupper In function `int main ()': call of overloaded `toupper (char &)' is ambiguous
/usr/include/ctype.h:112: candidates are: int toupper (int)
/usr/local/opt/include/g++-v3/bits/std_cctype.h:62:                 int std::toupper (int)

speedy$ gcc -v
Reading specs from /usr/local/opt/lib/gcc-lib/i686-pc-linux/2.96/specs
gcc version 2.96 20000727 (experimental)

(libstdc++-v3 configd with --enable-cshadow-headers --enable-namespaces)

Damon Brent Verner                        o      _     _         _
Cracker Jack? Surprise Certified  _o     /\_   _ \\o  (_)\__/o  (_)                _< \_   _>(_) (_)/<_    \_| \   _|/' \/               (_)>(_) (_)        (_)   (_)    (_)'  _\o_

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