2

First of all I have gone through this question Why is #include <iostream.h> bad? and there the reason was simply that it is outdated but I personally think that as a header iostream was better cos you don't have to declare objects like cout and endl in global scope cos they were already in global scope and moreover since # is not used anymore that means it does not comes under a pre-processor directive. I just need to know that why was this done? I still use turbo sometimes and am comfortable in using it in c++ programs even though gcc and g++ provide better debuggers and everything.

1
  • The best point made by jozefg was about the values of std being loaded in the global namespace
    – CAO
    Sep 16, 2013 at 18:06

1 Answer 1

10

I think you misunderstood the question. It's bad to include iostream.h because nowadays you should be using iostream. iostream.h is out of date, #include-ing it simply means that your code may or may not break, or shoot monkeys out of your nose, it's implementation defined.

Moving to iostream is simply moving to the standard version. You get the guarantee of it working, having an exception aware API, better localization, etc, etc.

Also, you don't want all of std dumped into global namespace. There is tons of stuff in there that you don't want to know about. Typing those 5 extra characters prevents weird errors if you have a class called map or something.

That being said, if you really want to use C++ as it was before 1998, have at it. But you're throwing away community support (The C++ community has moved on), updates, and any modern innovations from the last 1.5 decades. I think these outweigh the only downside I see, learning a few new things about how C++ has changed.

2
  • @CAO Anytime, if my answer answers your question you can click the green checkbox to mark it as accepted Sep 16, 2013 at 18:01
  • Yes, there seems to be a time constraint on the script of this page.
    – CAO
    Sep 16, 2013 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.