::std::boolalpha

S

Stefan Ram

Some books always #include <ios> and then »write«
::std::boolalpha before they print some boolean values.
It really is so natural: you print »false«, and there it
is written: »false«!

Why do you think the creators of C++ have decided to make
us use ::std::boolalpha, instead of making this the default
behavior and require to use ::std::noboolalpha or
::std::boolnumeric when numerals are wanted?
 
L

Luca Risolia

Stefan said:
Some books always #include <ios> and then »write«
::std::boolalpha before they print some boolean values.
It really is so natural: you print »false«, and there it
is written: »false«!

Why do you think the creators of C++ have decided to make
us use ::std::boolalpha, instead of making this the default
behavior and require to use ::std::noboolalpha or
::std::boolnumeric when numerals are wanted?

because "numerals" do not depend on locales?
 
L

Luca Risolia

Stefan said:
The literal »true« does not depend on locales. A direct printing
of a bool value anyways only seems to make sense for teaching or
debugging purposes. Therefore, it would not hurt to always print
»true« as English »true« - independent of the locale.

The universal way to print "true" as English "true" - independent of the
locale - is to print a number: "1".
 
S

Stefan Ram

Luca Risolia said:
because "numerals" do not depend on locales?

The literal »true« does not depend on locales. A direct printing
of a bool value anyways only seems to make sense for teaching or
debugging purposes. Therefore, it would not hurt to always print
»true« as English »true« - independent of the locale.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top