Topic: Other headers #included via iostream


Author: zerotIPredictNoSpammingype@yahoo.com
Date: Tue, 19 Jul 2005 20:25:35 GMT
Raw View
Hi,

As most of you probably already know, depending on which
implementation of C++ you have, #include <iostream> may cause various
other headers to be #included too. (I've observed cstring, cstdio,
cmath and I think cstdlib in g++)

Are there any that the standard requires to be "dragged in" like this
regardless of implementation?

Thanks,

James M.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: "Roger Orr" <rogero@howzatt.demon.co.uk>
Date: 19 Jul 2005 23:10:02 GMT
Raw View
<zerotIPredictNoSpammingype@yahoo.com> wrote in message
news:si3qd1l5ls9fmjbiatgmrcgetbcp6qbss6@4ax.com...
> Hi,
>
> As most of you probably already know, depending on which
> implementation of C++ you have, #include <iostream> may cause various
> other headers to be #included too. (I've observed cstring, cstdio,
> cmath and I think cstdlib in g++)
>
> Are there any that the standard requires to be "dragged in" like this
> regardless of implementation?

No - in fact all that is required is the declaration of cin, cout, cerr and
clog and the
wide character equivalents.

Why do you want to know?
In general do not make _any_ assumptions about the 'other' header files
which may be included by a standard header - explicitly include what you
need.
I know this is easier said than done, but it improves portability (across
platforms, or even across versions of compiler) if you try to do this.

Regards,
Roger Orr
--
MVP in C++ at www.brainbench.com


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]