Jump to content

Qual é a diferença entre iostream e iostream.h


Localhost
 Share

Recommended Posts

Qual é a diferença entre estas duas declarações no pré-processador? Também li que quando utilizámos iostream.h não é necessário declarar a namespace std. Isto será porque todos os headers já estão definidos no iostream.h e no iostream só está a namespace std?

here since 2009

Link to comment
Share on other sites

Penso que a diferença é nenhuma.

Teres:

#include <iostream>

ou

#include <iostream.h>

é a mesma coisa.

Mas sei que se estiveres a programar em C e utilizares um compilador de C não de C++ só de C tens que colocar #include <iostream.h> pois ele não aceita/reconhece #include <iostream>

Espero ter ajudado.

Link to comment
Share on other sites

Pois, já percebi.

Deixo ainda mais uma citação que encontrei aqui:

The difference between the .h and extensionless headers with the same name is historical. The ones with the .h extension are from the original C++ standard which did not have some modern features such as namespaces and templates. It was simpler for the new standard to put that same functionality in new header files to be able to use these new features and keep the old (.h) files for backward compatibility of legacy code.

here since 2009

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.