www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



c++ - isupper, islower (locale)

↑ ↓ ← Imbecil <shefututurorshefilor yahoo.com> writes:
Hi,


I think the ctype tables are wrong.
I'm getting  isupper (c, loc) == islower (c, loc)  for every c
in every loc.


Example program (which throws instead of returning 0):


//---------------------------------------------- Cut here...
#include <locale>

int main ()
{
  if (std::islower ('A', std::locale ()))
    throw 1;

  if (std::isupper ('a', std::locale ()))
    throw 2;

  return 0;
}
//---------------------------------------------- ... and here !


Ohh and BTW, shouldn't I be able to write
  islower ('A', std::locale ())
instead of std::islower (...) ?


Thank you for your time and your work on DMC. >:D<
Jan 09 2008
↑ ↓ Sunny Pal Singh <arorasp2000 hotmail.com> writes:
Imbecil wrote:
 Ohh and BTW, shouldn't I be able to write
   islower ('A', std::locale ())
 instead of std::islower (...) ?
 

You could use using namespace std; or using std::islower; & using std::locale; in the beginning before main or before the first access to function.
Jan 23 2008
↑ ↓ → Imbecil <shefututurorshefilor yahoo.com> writes:
Thank you. I will do just that. :)

I am not bothered too much by having to qualify the function name
with "std::" ; I mentioned this secondary, minor issue, because
it seemed to me that there might have been a bug in the compiler.

Since the type of the second argument is "locale"
from "namespace std", I thought that "namespace std" should
have been searched for "isupper"-named functions,
according to (my possible mis-understanding of) Koenig lookup:

  Example 4 (b)
  http://www.gotw.ca/publications/mill02.htm

(The primary, major issue I had was that of wrong ctype results.)

Thanks again ! :)
Jan 25 2008