On 2007-05-18 21:25Z, John Brown wrote:
> The following code compiles with gcc 3.4.2 and 4.1.1, but not with
> MSVC++ Express 2005 and OpenWatcom 1.6:
> This is due to the fact that gcc's <iostream> eventually includes
> <string>. My question is:
> Do you think that this is proper?
The standard [22.214.171.124/1] explicitly permits gcc to do that:
"A C++ header may include other C++ headers."
However, you rely on a compiler's doing so at your own risk.
Even if you include <string>, a conforming compiler can refuse to
compile the program you gave because you use std::endl without
including <ostream>. IIRC, the Committee's considering a change
that would deem <iostream> to make std::endl available because so
many experts have overlooked that particular point.