I cannot help answering the first part of the question (Who did that?). But it was answered in other posts.
As to the second part of the question (Well designed?), my answer is a resounding "No!". Here a little example which makes me shake my head in disbelief since years:
#include
#include
#include
// A small attempt in generic programming ;)
template
void ShowVector( const char *title, const std::vector<_T> &v)
{
std::vector<_T>::const_iterator iter;
std::cout << title << " (" << v.size() << " elements): ";
for( iter = v.begin(); iter != v.end(); ++iter )
{
std::cout << (*iter) << " ";
}
std::cout << std::endl;
}
int main( int argc, const char * argv[] )
{
std::vector byteVector;
std::vector wordVector;
byteVector.push_back( 42 );
wordVector.push_back( 42 );
ShowVector( "Garbled bytes as characters output o.O", byteVector );
ShowVector( "With words, the numbers show as numbers.", wordVector );
return 0;
}
The above code produces nonsense due to iostream design. For some reasons beyond my grasp, they treat uint8_t bytes as characters, while larger integral types are treated like numbers. Q.e.d. Bad design.
There is also no way I can think of to fix this. The type could as well be a float or a double instead... so a cast to 'int' to make silly iostream understand that numbers not chars are the topic will not help.
After receiving a down-vote to my reply, maybe a few more words of explanation...
IOStream design is flawed as it does not give the programmer a means to state HOW an item is treated. The IOStream implementation makes arbitrary decisions (such as treating uint8_t as a char, not a byte number). This IS a flaw of the IOStream design, as they try to achieve the unachievable.
C++ does not allow to classify a type - the language does not have the facility. There is no such thing as is_number_type() or is_character_type() IOStream could use to make a reasonable automatic choice. Ignoring that and trying to get away with guessing IS a design flaw of a library.
Admitted, printf() would equally fail to work in a generic "ShowVector()" implementation. But that is no excuse for iostream behavior. But it is very likely that in printf() case, ShowVector() would be defined like this:
template
void ShowVector( const char *formatString, const char *title, const std::vector<_T> &v );