This is the mail archive of the libstdc++@sources.redhat.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]

std C functions && namespace std;


Hi,

  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 ;)

thanks.
  Brent


#include <iostream>
using namespace std;

int
main(){
  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. toupper.cc -o toupper 
toupper.cc: In function `int main ()':
toupper.cc:10: 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  (_)
brent@rcfile.org                _< \_   _>(_) (_)/<_    \_| \   _|/' \/
brent@linux1.org               (_)>(_) (_)        (_)   (_)    (_)'  _\o_

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