From 8351661622164215391
X-Google-Thread: f78e5,c4a7f0fb4ab1315a
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII
Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Fri, 23 Mar 2007 13:50:17 -0500
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
From: "James Kanze" <james.kanze@gmail.com>
Newsgroups: comp.std.c++
Subject: Re: Possible ambiguity in parsing complex depending on locale ?
Organization: http://groups.google.com
Message-ID: <1174640834.807538.167790@n76g2000hsh.googlegroups.com>
References: <ettnao$680$1@news-sop.inria.fr>
   <howard.hinnant-CFDC96.12182122032007@johnf2.biosci.ohio-state.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Complaints-To: groups-abuse@google.com
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: n76g2000hsh.googlegroups.com; posting-host=62.160.54.162;
   posting-account=uN4QgA0AAAC_qk3WofNKjyjXNSBMXL2b
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by mulga.csse.unimelb.edu.au id l2N97Msr004633
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Date: Fri, 23 Mar 2007 13:43:28 CST
Lines: 58
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-HhOA+xFUTB3laBOak6ITHoN+FD/z80niMxQj4BPs4gd5idWHOQvqqmP+MBV+IGvzfuNcWS2LpyVaCjz!nh/MyTr1yfAGbDBhkYqEgSHaLHGKUM2yosKBkgdtruGPN5mdf04pISdgRUxXlMZl8spgkpSTbK3m!QRQHabtSzdxwWcE7OMEioGnTTjGdY4rw8bMgIiK504c=
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.34
Xref: g2news1.google.com comp.std.c++:8195

On Mar 22, 5:48 pm, howard.hinn...@gmail.com (Howard Hinnant) wrote:
> In article <ettnao$68...@news-sop.inria.fr>,
>  Sylvain Pion <Sylvain.P...@sophia.inria.fr> wrote:
> > I am wondering if there can be an ambiguity in parsing std::complex
> > from a stream, depending on the locale.  The standard says:

> > template<class T, class charT, class traits>
> > basic_istream<charT, traits>&
> > operator>>(basic_istream<charT, traits>& is , complex<T>& x );

> > Effects: Extracts a complex number x of the form: u, (u), or (u,v),
> > where u is the real part and v is the imaginary part.

> > Now, what happens if the decimal point is a comma, following the locale?
> > In that case, "(1,2)" could be parsed in 2 different ways, in practice
> > ending up with the complex number being the real number 1.2 instead
> > of (1,2).

> > I am not very familiar with how locales work, so I don't know if they
> > can affect this stream operator.

> > The context of this question is that I have the same issue for the
> > std::interval proposal (N2137), where intervals can be read as [u]
> > or [u,v].

> You're in good company:

> http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#629

> We're wondering too. :-)

As Plauger pointed out, there's no wondering about what the
current standard requires.  Of course, what it requires makes it
more or less impossible to read and write complex values in most
European locales, but who cares about us Europeans:-)?

> Note that there's no proposed resolution.  :-(

There are, in fact, several; they just appear in the discussion
session.  (I personally favor the first, as it seems the
simplest and least likely to cause problems elsewhere.)

Note too that the issue is only dated from Jan. of this year, so
the committee hasn't yet had the time to discuss it.

--
James Kanze (GABI Software)             email:james.kanze@gmail.com
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.comeaucomputing.com/csc/faq.html                      ]



