From 63648427748149006
X-Google-Thread: f78e5,e1d72e3830635ee
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII
Path: g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 01 Aug 2005 12:30:20 -0500
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Delivered-To: std-c++@ucar.edu
From: kanze@gabi-soft.fr
Newsgroups: comp.std.c++
Subject: Re: std::tolower - which one should be visible?
Organization: http://groups.google.com
Message-ID: <1122898436.644405.162540@z14g2000cwz.googlegroups.com>
References: <dbqg7i$fa2$1@sunnews.cern.ch>
   <1122301061.460975.257060@g49g2000cwa.googlegroups.com>
   <42e55374$1_3@news.bluewin.ch>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Complaints-To: groups-abuse@google.com
User-Agent: G2/0.2
Complaints-To: groups-abuse@google.com
Injection-Info: z14g2000cwz.googlegroups.com; posting-host=62.160.54.162;
   posting-account=qsfl8gwAAABZGaLp2a7FeTfDkJamzWYW
X-Virus-Scanned: amavisd-new at ucar.edu
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by mailman.ucar.edu id j71CWcNC012607
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Date: Mon,  1 Aug 2005 12:24:31 CST
Lines: 35
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-FZRRuSXfbXxnnS9agghFg7378/r3vHeuoRv9nTPiaYGJeVUQQrvHumga3eDNgieVQQXAI0d818ddeal!dPrtb+3uz2B1MjKYAqvNkwHcpQTLoyq1J6p8T2nStpZGM3BWwcNgL4UcCrGLlNpZKWMyokzKC30p!s1M0776HIps8P0cA5NrkLeU3Fby9s6XDh46nkKRfpRs=
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32
Xref: g2news1.google.com comp.std.c++:1584

Maciej Sobczak wrote:
> kanze@gabi-soft.fr wrote:

> > Except that calling the standard C version of tolower with a
> > char argument is undefined behavior, of course.

> I don't understand this assertion. The argument of C version
> of tolower has to be representable by unsigned char or equal
> to EOF. Staying within the ASCII range [0..127], all character
> codes seem to fit this requirement.

> What's the real problem?

The fact that char does not guarantee that its value is in ASCII
range.  The fact that it almost never is in practice, even when
reading supposedly text data.

The usual solution in C is to cast the char to unsigned char
before calling any of the functions in ctype.h.  The preferred
solution in C++ is, of course, to use one of the functions in
<locale>.

--
James Kanze                                           GABI Software
Conseils en informatique orient�e objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place S�mard, 78210 St.-Cyr-l'�cole, France, +33 (0)1 30 23 00 34


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



