Difference between revisions of "Talk:cpp/io/basic ios/clear"
Alexis wilke (Talk | contribs) (Fix signature?) |
(Example behaviour is undefined.) |
||
Line 4: | Line 4: | ||
The following paragraph is confusing "If rdbuf() is a null pointer (i.e. there is no associated stream buffer), then state | badbit is assigned. May throw an exception." --- can the `clear()` function throw if the `rdbuf()` is a null pointer? Is that an exclusive or? What may throw exactly? --Alexis Wilke 12:54, 19 April 2021 (PDT) | The following paragraph is confusing "If rdbuf() is a null pointer (i.e. there is no associated stream buffer), then state | badbit is assigned. May throw an exception." --- can the `clear()` function throw if the `rdbuf()` is a null pointer? Is that an exclusive or? What may throw exactly? --Alexis Wilke 12:54, 19 April 2021 (PDT) | ||
+ | |||
+ | I'm pretty sure that the example is not guaranteed to work. | ||
+ | You can only reliably putback the last character read because otherwise the implementation would have to allocate and maintain an arbitrarily sized input buffer. | ||
+ | Nick H | ||
+ | [[Special:Contributions/194.74.130.171|194.74.130.171]] 00:15, 18 August 2021 (PDT) |
Revision as of 23:15, 17 August 2021
"Run" stopped with error, because there is no input data. Probably it can be emulated by echo -e: http://coliru.stacked-crooked.com/a/a371edbd37cc7a63 Ruslo (talk) 03:03, 5 September 2013 (PDT)
- I've added this to my todo list. --P12 14:26, 10 September 2013 (PDT)
The following paragraph is confusing "If rdbuf() is a null pointer (i.e. there is no associated stream buffer), then state | badbit is assigned. May throw an exception." --- can the `clear()` function throw if the `rdbuf()` is a null pointer? Is that an exclusive or? What may throw exactly? --Alexis Wilke 12:54, 19 April 2021 (PDT)
I'm pretty sure that the example is not guaranteed to work. You can only reliably putback the last character read because otherwise the implementation would have to allocate and maintain an arbitrarily sized input buffer. Nick H 194.74.130.171 00:15, 18 August 2021 (PDT)