Topic: wrong description of effect 1 of basic_istream:: ignore


Author: Krzysztof =?UTF-8?B?xbtlbGVjaG93c2tp?=<giecrilj@stegny.2a.pl>
Date: Sun, 11 Sep 2011 09:12:57 -0700 (PDT)
Raw View
[istream.unformatted] in N3242 currently has the following to say about the
semantics of basic_istream:: ignore:

    Characters are extracted until any of the following occurs:
    if n != numeric_limits<streamsize>::max() (18.3.2), n characters are
extracted

This statement, apart from being slightly ungrammatical, indicates that if
(n == numeric_limits<  streamsize>:: max ()), the method returns without
extracting any characters.

The intended semantics would be described by the following statement:

    (n != numeric_limits<  streamsize>:: max ()) (18.3.2) and (n) characters
have been extracted so far.

IMHO,
Chris


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]




Author: =?UTF-8?B?RGFuaWVsIEtyw7xnbGVy?=<daniel.kruegler@googlemail.com>
Date: Tue, 20 Sep 2011 10:11:14 -0700 (PDT)
Raw View
Am 11.09.2011 18:12, schrieb Krzysztof   elechowski:
>  [istream.unformatted] in N3242 currently has the following to say about the
>  semantics of basic_istream:: ignore:
>
>       Characters are extracted until any of the following occurs:
>      if n != numeric_limits<streamsize>::max() (18.3.2), n characters are
>  extracted
>
>  This statement, apart from being slightly ungrammatical, indicates that if
>  (n == numeric_limits<    streamsize>:: max ()), the method returns without
>  extracting any characters.

I tend to disagree in regard to your argumentation chain. If we have the
situation "n == numeric_limits<streamsize>::max()", the first bullet can
never be entered (because it simply does not occur) but the initiating
assertion ("Characters are extracted until any of the following occurs")
still holds. Therefore, in this case the stop condition for character
extraction can only be one of bullet two or bullet three.

>  The intended semantics would be described by the following statement:
>
>      (n != numeric_limits<    streamsize>:: max ()) (18.3.2) and (n) characters
>  have been extracted so far.

I agree that this would be an editorially improved way of describing the
same thing, but I doubt that the intent could be really misunderstood.
Do you have an example for an implementation that does this wrong based
on your (or any other) interpretation? In this case I would first start
with a bug report and if still disagreement exists on this topic I
suggest to bring this issue forward again.

Thanks&  Greetings from Bremen,

Daniel Kr  gler



--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]




Author: Krzysztof =?UTF-8?B?xbtlbGVjaG93c2tp?=<giecrilj@stegny.2a.pl>
Date: Sat, 24 Sep 2011 21:46:37 -0700 (PDT)
Raw View
Daniel Kr  gler wrote:

>  Am 11.09.2011 18:12, schrieb Krzysztof   elechowski:
>>   [istream.unformatted] in N3242 currently has the following to say about
>>   [the
>>   semantics of basic_istream:: ignore:
>>
>>        Characters are extracted until any of the following occurs:
>>       if n != numeric_limits<streamsize>::max() (18.3.2), n characters are
>>   extracted
>>
>>   This statement, apart from being slightly ungrammatical, indicates that
>>   if
>>   (n == numeric_limits<     streamsize>:: max ()), the method returns
>>   without extracting any characters.
>
>  I tend to disagree in regard to your argumentation chain. If we have the
>  situation "n == numeric_limits<streamsize>::max()", the first bullet can
>  never be entered (because it simply does not occur) but the initiating
>  assertion ("Characters are extracted until any of the following occurs")
>  still holds. Therefore, in this case the stop condition for character
>  extraction can only be one of bullet two or bullet three.

The description intends to describe the observable behaviour of an
implementation in terms of logical assertions.  Logical assertions are not
"bullets" that can be "entered" but need not; they are predicates that can
evaluate to true or false.

The description contains two predicates, either of them causes extraction to
terminate.  In the incriminated case, the first predicate is evaluates to
true because its premise is false, therefore no characters will be
extracted.

IMHO,
Chris



--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]




Author: =?UTF-8?B?RGFuaWVsIEtyw7xnbGVy?=<daniel.kruegler@googlemail.com>
Date: Sun, 25 Sep 2011 08:31:23 -0700 (PDT)
Raw View
Am 25.09.2011 06:46, schrieb Krzysztof   elechowski:
>  Daniel Kr  gler wrote:
>
>>    Am 11.09.2011 18:12, schrieb Krzysztof   elechowski:
>>>     [istream.unformatted] in N3242 currently has the following to say about
>>>     [the
>>>     semantics of basic_istream:: ignore:
>>>
>>>          Characters are extracted until any of the following occurs:
>>>         if n != numeric_limits<streamsize>::max() (18.3.2), n characters are
>>>     extracted
>>>
>>>     This statement, apart from being slightly ungrammatical, indicates that
>>>     if
>>>     (n == numeric_limits<       streamsize>:: max ()), the method returns
>>>     without extracting any characters.
>>
>>    I tend to disagree in regard to your argumentation chain. If we have the
>>    situation "n == numeric_limits<streamsize>::max()", the first bullet can
>>    never be entered (because it simply does not occur) but the initiating
>>    assertion ("Characters are extracted until any of the following occurs")
>>    still holds. Therefore, in this case the stop condition for character
>>    extraction can only be one of bullet two or bullet three.
>
>  The description intends to describe the observable behaviour of an
>  implementation in terms of logical assertions.  Logical assertions are not
>  "bullets" that can be "entered" but need not; they are predicates that can
>  evaluate to true or false.
>
>  The description contains two predicates, either of them causes extraction to
>  terminate.  In the incriminated case, the first predicate is evaluates to
>  true because its premise is false, therefore no characters will be
>  extracted.

Yes, you are correct, I misread your interpretation. I forwarded your
issue to the library group.

Thanks&  Greetings from Bremen,

Daniel Kr  gler



--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]