Why is std::streamsize defined as signed rather than unsigned?
问题 According to http://en.cppreference.com/w/cpp/io/streamsize The type std::streamsize is a signed integral type used to represent the number of characters transferred in an I/O operation or the size of an I/O buffer. As far as I can imagine, a stream's size can never be negative, so, my question is: Why is std::streamsize defined as signed rather than unsigned ? What's the rationale behind? 回答1: The draft C++ standard has the following footnote 296 in section 27.5.2 Types which says: