What is the point of including files without using ".h"??
What is the point of including files without using ".h"??
I have a rabbit in my pants! Please be happy for me.
It's what is reffered to as the header files and they in turn include the cpp file.
Last edited by Zahl; 10-14-2002 at 09:43 AM.
Well english isn't my first language, (it's instead a useless language called danish which only 5 milion people speak!!) so if you think my grammar SUCKS (it does by the way) than you're more then welcome to correct me.
Hell I might even learn something
iostream is part of the C++ standards recommended headers....iostream.h was implemeted before the standard, but not all versions in compilers of the time were wrapped in namespace std....so therefore they could have proposed all future implementations should be in std:: (in which case lots of legacy code would need to be rewritten for use on standard complient compilers) - and that wouldnt have been popular!!!
They went a completely different way and proposed a seperate header that provided all the same functionality of iostream.h, but wrapped it in namepsapce std..(this was <iostream>)
You can still use iostream.h, but it has been deprecated and should only be used for legacy code
When i use my MSVC++ 6.0 std edition it doens't let me not use the .h....
"When i use my MSVC++ 6.0 std edition it doens't let me not use the .h...."
It does, except that the whole standard library is in namespace std.
Code:#include <iostream> int main() { std::cout << "Look Ma, standard compliant C++ code" << std::endl; return 0; }
ok, thnx for the clarification.
I use the #include<iostream>
and then add
using namespace std;
Is the difference that iostream is devided into classes like std and ios ???
Thanks for help.
If you don't want to #include the whole std namespace when using <iostream> or other #includes w/o the .h, include only the parts your program uses.
This allows you to avoid SilentStrike's method of having to prefix every use with std::, which is perfectly valid, but which seems awkward to me.Code:#include <iostream> using std::cout; using std::cin; // etc, instead of using namespace std;
Truth is a malleable commodity - Dick Cheney
No!Originally posted by ammar
Is the difference that iostream is devided into classes like std and ios ???
in <iostream> everything is in the namespace std. std is a namespace, not a class!
ios is a typedef to hide ios_base! (which is a class)
But there are more differences - the implementation of <iostream> is much newer than <iostream.h>.
I don't know exactly where the differences are, but I think I read a good article at cuj.com
Hope you don't mind my bad english, I'm Austrian!
Theoretically <iostream> should conform to the standard on C++ compilers, while <iostream.h> is deprecated so can be just about anything.....Originally posted by ammar
Is the difference that iostream is devided into classes like std and ios ???
Thanks for help.
But practically, compiler vendors usually implement the iostreams in one way and provide one header in namespace std, and the other in global scope...so they most likely represent the same functions.