Why iostream is No Longer Included as a Header File in C++

c

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.

Best Answer

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.