<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">On Nov 20, 2017, at 16:33, Reimar Döffinger <<a href="mailto:Reimar.Doeffinger@gmx.de" class="">Reimar.Doeffinger@gmx.de</a>> wrote:<br class=""><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On 20 November 2017 22:19:04 CET, Volodymyr Sapsai <</span><a href="mailto:vsapsai@apple.com" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">vsapsai@apple.com</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">> wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">On Nov 20, 2017, at 11:32, Reimar Döffinger <<a href="mailto:Reimar.Doeffinger@gmx.de" class="">Reimar.Doeffinger@gmx.de</a>><br class="">wrote:<br class=""><blockquote type="cite" class=""><br class="">On Mon, Nov 20, 2017 at 11:02:13AM -0800, Volodymyr Sapsai wrote:<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""> catch (...)<br class=""> {<br class="">+ if (__n > 0)<br class="">+ *__s = char_type();<br class=""> this->__set_badbit_and_consider_rethrow();<br class=""> }<br class=""></blockquote><br class="">or maybe something else?<br class=""></blockquote><br class="">That one (note that the __set_badbit_and_consider_rethrow<br class="">will never re-throw in this case).<br class=""></blockquote><br class="">But by #define _LIBCPP_NO_EXCEPTIONS 1 you exclude this block at<br class="">preprocessing step<br class=""><br class=""><blockquote type="cite" class="">#ifndef _LIBCPP_NO_EXCEPTIONS<br class=""> }<br class=""> catch (...)<br class=""> {<br class="">+ if (__n > 0)<br class="">+ *__s = char_type();<br class=""> this->__set_badbit_and_consider_rethrow();<br class=""> }<br class="">#endif // _LIBCPP_NO_EXCEPTIONS<br class=""></blockquote><br class="">And looks like getline_pointer_size_exception.pass.cpp doesn’t execute<br class="">this code.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Yes, that was complete nonsense, I somehow always read #ifdef where there was an #ifndef...</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Not sure then if that 0 termination should be there (and be tested) or better to not have it in the exception case at all (I haven't checked if the exception is always re-thrown or not, which might be relevant).</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I am a bit unclear about that whole code there that catches exceptions and sets the bad bit and how it maps to the specification.</span></div></blockquote></div><br class=""><div class="">Standard mentions</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">Otherwise, if the sentry constructor exits by throwing an exception or if the sentry object returns false, when converted to a value of type bool, the function returns without attempting to obtain any input. In either case the number of extracted characters is set to 0; unformatted input functions taking a character array of non-zero size as an argument shall also store a null character (using charT()) in the first location of the array.</blockquote><br class=""></div><div class="">My understanding is that if sentry constructor throws an exception we need to null-terminate a character array. Null-termination isn’t specified explicitly for exceptions thrown in other cases but I think it would be more cumbersome to perform null-termination only for sentry exceptions and not for others. Regarding the safety, we control __s, don’t pass it anywhere, it never points beyond __n - I think null-termination should be safe. Also libstdc++ does null-termination when exceptions are thrown.</div><div class=""><br class=""></div><div class="">As for rethrowing exception, looks like exceptions flag std::istream::eofbit causes exception to be thrown and std::istream::badbit to be rethrown according to</div><div class=""><blockquote type="cite" class="">If (exceptions()&badbit) != 0 then the exception is rethrown.</blockquote>And looks like libstdc++ rethrows exception even if badbit is not set.</div><div class=""><br class=""></div><div class="">If you feel comfortable, I can finish exception tests myself and commit the patch. How does it sound?</div></body></html>