Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this question
    
The best point made by jozefg was about the values of std being loaded in the global namespace –  CAO Sep 16 '13 at 18:06

1 Answer 1

up vote 8 down vote accepted

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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