Does ignoring use ignore (numeric_limits <streamsize> :: max ()) in the IOStreams library handle arbitrarily massive threads?

In the C ++ standard (section 27.6.1.3 \ 24) for istream ignore()in the IOStreams library, this means that if you specify an argument for 'n' from numeric_limits::max(), it will continue to ignore characters forever until a separator is found, even beyond the actual maximum value for streamsize (ie, the argument "n" is interpreted as infinite).

For a gcc implementation, it really looks like it ignore(), but it’s still unclear to me that whether this is a specific implementation or authorized by the standard. Can someone who knows this confirm that this is guaranteed by the standard iostreams library?

+3
source share
2 answers

The standard states that numeric_limits<streamsize>::max()- this is a special value that does not affect the number of missing characters.

: ( 27.7.2.3, 1). . , :
 - n != numeric_limits<streamsize>::max() (18.3.2), n  - ( setstate (eofbit), ios_base:: failure (27.5.5.4))

 - traits:: eq_int_type (:: to_int_type (c), delim) c ( c ).

+5

:

istream&  istream::ignore ( streamsize n = 1, int delim = EOF );

.

, n , delim, , . .

, numeric_limits:: max() , .

[Per Bo]

, , , n , numeric_limits<streamsize>::max().

0

All Articles