Topic: std::locale is* functions - why no default argument?


Author: ncm@nospam.cantrip.org (Nathan Myers)
Date: 1998/02/04
Raw View
Brad Daniels <brad.daniels@missioncritical.com> wrote:
>I was looking at the standard isspace function, and I noticed that the
>version I have (CD2) doesn't list any of the character classification
>functions as taking a default locale argument ...

Take a look at your C compiler manual, under "isspace".
Now, the global C locale it uses isn't the same as the the global
C++ locale obtained by "std::locale()"; and the C isspace takes an
int, not a char; but overloading isspace on int and char alone
would only have added to the confusion.

Incidentally, the "const" qualifiers in CD2 were a typo, fixed
in FDIS.

I'm glad to see somebody reading the locale chapter.  See
http://www.cantrip.org/locale.html for some more information.

Nathan Myers
ncm@nospam.cantrip.org  http://www.cantrip.org/
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]





Author: "Brad Daniels" <brad.daniels@missioncritical.com>
Date: 1998/02/03
Raw View
I was looking at the standard isspace function, and I noticed that the
version I have (CD2) doesn't list any of the character classification
functions as taking a default locale argument, though it does contain a note
(in section 22.1.1.2) that std::locale::locale() "is  commonly used as the
default value for arguments of functions that take a const local &
argument."  The implementation of the STL that I use does in fact provide
locale() as the default value for the locale argument to the character
classification functions, but I'm wondering if it's standard-conforming for
it to do so.  It's certainly sensible behavior, and behavior that I'd like
to depend on.  Does anyone know why it wasn't included in the standard (or
did it make it after CD2?)

Thanks,
- Brad
--
----------------------------------------------------------------------------
Brad Daniels                  |  Was mich nicht umbringt macht mich hungrig.
Mission Critical Software     |   - Otto Nietzche
Standard disclaimers apply    |     (Friedrich's corpulent brother)
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]