Topic: Defect: expressions parsed differently than intended (N2914)


Author: Seungbeom Kim <musiphil@bawi.org>
Date: Fri, 26 Jun 2009 23:13:45 CST
Raw View
In Table 73     Floating-point conversions, [facet.num.put.virtuals],
in N2914, we have the following entries:

floatfield == ios_base::fixed | ios_base::scientific && !uppercase  (%a)
floatfield == ios_base::fixed | ios_base::scientific                (%A)

These expressions are supposed to mean:

floatfield == (ios_base::fixed | ios_base::scientific) && !uppercase
floatfield == (ios_base::fixed | ios_base::scientific)

but technically parsed as:

((floatfield == ios_base::fixed) | ios_base::scientific) && (!uppercase)
((floatfield == ios_base::fixed) | ios_base::scientific)

and should be corrected with additional parentheses, as shown above.

I couldn't find this issue in the C++ Standard Library Issues List
(Revision R65).

--
Seungbeom Kim


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: Howard Hinnant <howard.hinnant@gmail.com>
Date: Mon, 29 Jun 2009 10:06:08 CST
Raw View
On Jun 27, 1:13 am, Seungbeom Kim <musip...@bawi.org> wrote:
> In Table 73    Floating-point conversions, [facet.num.put.virtuals],
> in N2914, we have the following entries:
>
> floatfield == ios_base::fixed | ios_base::scientific && !uppercase  (%a)
> floatfield == ios_base::fixed | ios_base::scientific                (%A)
>
> These expressions are supposed to mean:
>
> floatfield == (ios_base::fixed | ios_base::scientific) && !uppercase
> floatfield == (ios_base::fixed | ios_base::scientific)
>
> but technically parsed as:
>
> ((floatfield == ios_base::fixed) | ios_base::scientific) && (!uppercase)
> ((floatfield == ios_base::fixed) | ios_base::scientific)
>
> and should be corrected with additional parentheses, as shown above.
>
> I couldn't find this issue in the C++ Standard Library Issues List
> (Revision R65).

This is now LWG issue 1152:

http://home.roadrunner.com/~hinnant/issue_review/lwg-active.html#1152

-Howard


--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]