iostream,iostream.h differences

Source: Internet
Author: User



1.
No. h is now standard in C + +, with the aim of making C + + code available for porting and blending embedding without the extension. h restrictions,
Avoid additional processing and modification caused by. h is the use of C, but it is also supported in C + +.
Mainly in order to backward-compatible with C content, we usually try not to use this method
That's a good thing the friends upstairs have said.
However, # include <iostream> using namespace std;
or # include <iostream>
void Main ()
{//。。。
Std::cout (""); This output does not need to add std::, and directly write cout<< ""; it can be output, this I have tried, certainly to
}








2.


Iostream is now a standard in C + +, designed to make C + + code available for porting and blending without the extension. h restrictions,
Avoid additional processing and modification due to. h. Iostream contains the same basic functionality as the corresponding old header file,
But the contents of the header file are in the namespace Std.
(in the process of normalization, the details of some parts of the library have been modified, so the old header files and the entities in the new header file do not necessarily correspond exactly.) )
In general, this header file should be used, while the iostream.h is old-fashioned and may be eliminated later.




Technically, there is no such thing as <iostream.h>-the standardization committee replaced it with <iostream> when simplifying the non-C standard header file.
The reasons for their doing so are explained in clause 49. It is also important to know that if the compiler supports both <iostream> and &LT;IOSTREAM.H&GT;
The use of the file name will be very subtle. For example, if you are using # include &LT;IOSTREAM&GT;
Get the elements of the iostream library placed under the namespace STD (see clause 28), if you use # include <iostream.h>
The same elements that are placed in the global space are obtained. Getting elements in the global space can cause name collisions,
The design of the namespace is designed to avoid this name conflict. Also, when typing <iostream> less than <iostream.h> two words,
That's why a lot of people use it. :)·
Old C + + header filenames such as <iostream.h> will continue to be supported, although they are not in the official standard.
The contents of these header files are not in the namespace Std.
· The new C + + header file, such as <iostream> contains the same basic functionality as the corresponding old header file, but the contents of the header file are in the namespace Std.
(in the process of normalization, the details of some parts of the library have been modified, so the old header files and the entities in the new header file do not necessarily correspond exactly.) )

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.