Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

mokermachine

<iostream.h> and <iostream>

This topic is 5666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
iostream.h is the pre-standard version of iostream.

iostream is right, iostream.h is wrong. Don''t use iostream.h

Share this post


Link to post
Share on other sites
The newer C++ header files are the ones without the h. This includes the STL template classes. The main difference is that all the functions and constants are in the std namespace, to avoid global namespace polution and potential conflicts with legacy code. To summarize, you should not use the .h; its deprecated.

Share this post


Link to post
Share on other sites
quote:
Original post by invective
you should not use the .h; its deprecated.

If you''re ever stuck for something to say at cocktail parties, try this one... To be deprecated, it has to have been part of the Standard to begin with. iostream.h never was part of the C++ Standard.

Share this post


Link to post
Share on other sites
The same goes for many other header files (cstdio, cstring, etc), does it not? I usually use the .h-less versions, unless I''m feeling too lazy to care.

Why did they ever get used if they were never included in any standard? And why is the MSDN help full of the .h versions?

Harry.

Share this post


Link to post
Share on other sites
quote:
Original post by HarryW
Why did they ever get used if they were never included in any standard?


What an interesting question.

Share this post


Link to post
Share on other sites
quote:
Original post by SabreMan
To be deprecated, it has to have been part of the Standard to begin with.


Does it? Webster says the verb "deprecate" means "to express disapproval of". It says nothing to the effect of that the subject in question has to have been formally standardized.
quote:

iostream.h never was part of the C++ Standard.

It was never part of a formal C++ Standard. But doesn''t the ARM, which I believe constituted a de facto standard back in the days, describe it?



"Laughter means distance. Where laughter is absent, madness begins. The moment one takes the world with complete seriousness one is potentially insane. The whole art of learning to live means holding fast to laughter; without laughter the world is a torture chamber, a dark place where dark things will happen to us, a horror show filled with bloody deeds of violence."
-- Jens Bjørneboe

Share this post


Link to post
Share on other sites
quote:
Original post by Arild Fines
Does it? Webster says the verb "deprecate" means "to express disapproval of".

The C++ Standard says...
quote:

[...] deprecated is defined as: Normative for the current edition of the Standard, but not guaranteed to be part of the Standard in future revisions.

quote:

It says nothing to the effect of that the subject in question has to have been formally standardized.

I''d hazard a guess that''s because Websters doesn''t define the C++ language and associated terms.

Share this post


Link to post
Share on other sites
quote:
Original post by HarryW
The same goes for many other header files (cstdio, cstring, etc), does it not?

No. Those headers (the "stdio.h" form that is) are part of the C89 Standard and are included into the C++98 Standard by reference.
quote:

Why did they ever get used if they were never included in any standard?

Because C++ existed for several years before it got an ISO Standard.
quote:

And why is the MSDN help full of the .h versions?

Because it contains out-of-date information. And because MS provide an iostream.h header, so can guarantee it's presence (which ISO cannot).


[edited by - SabreMan on April 18, 2003 9:04:03 PM]

Share this post


Link to post
Share on other sites
VC++7.0(and upwards, I assume) gives you compilation warnings when including the .h headers, though.



"Laughter means distance. Where laughter is absent, madness begins. The moment one takes the world with complete seriousness one is potentially insane. The whole art of learning to live means holding fast to laughter; without laughter the world is a torture chamber, a dark place where dark things will happen to us, a horror show filled with bloody deeds of violence."
-- Jens Bjørneboe

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!