All the names in the standard C++ library are lowercase except std::ios_base::Init
. Why is this?
In an early draft of the IOStream classes you can see that ios_base
was originally not present, basic_ios
was the base class and was responsible for Init
and other members which were later separated into ios_base
.
basic_ios
also had (and still has) an init
function, and while the two names did not necessarily have to be distinct, presumably to try and avoid confusion it was decided to name the class Init
and the function init
. Also, without this distinction something like the following would have been necessary when using the class:
struct ios_base
{
struct init{};
void init();
};
ios_base::init i1; // error
struct ios_base::init i2; // ok
The idea of having a separate class responsible for initializing the standard streams goes back to at least CFront 3.0, as can be seen by Iostream_init
in this header. At some point it was decided not only to make the class a member of ios
/ basic_ios
/ ios_base
but that it should be renamed Init
.
In any case it makes sense to disambiguate the two, even considering the fact that they were ultimately placed in separate classes. They could have chosen completely separate names instead, but presumably Init
/ init
was considered as the best semantic choice to describe what the class and function do, and there's also a chance it was simply mimicking the older Iostream_init
, which for some reason also starts with an uppercase I
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With