Why does # include <iostream. h> become obsolete?

Source: Internet
Author: User
Tags bitset

Original article http://www.cpp-home.com/forum/viewtopic.php? T = 252

Why?# Include <iostream. h>Outdated

In earlier years, C ++ had no standards. All compiler vendors simply followed a rough convention like "what should be there. And you often cannot easily port a program from one compiler/platform to another because of some annoying little differences. So the C ++ jazz sat before the round-table and, after heated discussions, developed a standard called ISO-C ++. This standard is also known as standard C ++, C ++ 98 or more officially ISO/IEC 14882: 1998.

Your ad here


In this standard, many old header files are standardized, so that you can use a fixed manual without worrying about which compiler you are using. In order to be different from the old header file, the new header file removes the. h suffix. Therefore# Include <iostream. h>Now# Include <iostream>This is also true for many other header files.

The new header file is included in the standard namespace. Any object in the new header file, suchCoutAndEndlCan be found in the namespace STD or accessed independently.

# Include <iostream>
Void F (){
STD: cout <"blah" <STD: Endl;
// Note: Standard Library identifiers are to be prefixed with STD ::
}


Or separate slave namespaceSTDImport

# Include <iostream>
Using STD: cout;
Void F (){
Cout <"blah" <STD: Endl;
// Note: prefix STD: not neccesary for cout, but for Endl
};

Or use the following statement to import the namespaceSTDEverything in (NoWe recommend that you write header files (not recommended for writing header files ))

# Include <iostream>
Using namespace STD;
Void F (){
Cout <"blah" <Endl;
// Note: prefix STD: not needed at all
};

Use it as usualCout,No need to add STD: to the front.

Namespace is very useful, but it does not need to be too concerned about them for beginners, as long as you addUsing namespace stdYou don't have to worry about it now. What you have the chance to do is read some information about namespace.

The standard header file of C ++ is:

  • <Algorithm> invalid useful algorithms, like STD: Copy
  • <Bitset> bitset
  • <Complex> complex numbers
  • <Deque> deque containters
  • <Exception> Exception Handling
  • <Fstream> file IO
  • <Functional> function objects
  • <Iomanip> Io Manipulators
  • <IOS> Io base classes
  • <Iosfwd> Io forward declarations
  • <Iostream> Io streams
  • <Istream> input streams
  • <Iterator> useful iterators, like STD: ostream_iterator
  • <Limits> Implementation Properties
  • <List> List containers
  • <Locale> i18 locales
  • <Map> assiociative containers
  • <Memory> Memory Management
  • <New> dynamic memory management
  • <Numeric> numeric limits
  • <Ostream> output streams
  • <Queue> queue containers
  • <Set> set containers
  • <Sstream> string streams
  • <Stack> stack containers
  • <Stdexcept> exception classes
  • <Streambuf> stream buffer classes
  • <String> string classes
  • <Typeinfo> type identification
  • <Utility> utility component
  • <Valarray> arrays of Values
  • <Vector> vector containers
  • <Cassert> adapted assert. h from C
  • <Cctype> adapted ctype. h from C
  • <Cerrno> adapted errno. h from C
  • <Cfloat> adapted float. h from C
  • <Climits> adapted limits. h from C
  • <Clocale> adapted locale. h from C
  • <Cmath> adapted math. h from C
  • <Csetjump> adapted setjump. h from C
  • <Csignal> adapted signal. h from C
  • <Cstdarg> adapted stdarg. h from C
  • <Cstddef> adatped stddef. h from C
  • <Cstdio> adapted stdio. h from C
  • <Cstdlib> adapted stdlib. h from C
  • <Cstring> adapted string. h from C
  • <Ctime> adapted time. h from C
  • <Cwchar> adapted wchar. h from C
  • <Cwctype> adapted wctype. h from C

Link to more documents on the Internet:

  • Http://www.cppreference.com/quite nice, covers the most commoned used things
  • Http://www.cplusplus.com/ref/ covers only few of the headers.
  • Http://gcc.gnu.org/onlinedocs/libstdc++/documentation.html lots of information
  • Http://msdn.microsoft.com/library/default.asp? Url =/library/en-US/vcstdlib/html/vclrfcpluspluslibraryoverview. asp Ms's docu to the VC ++ standard Libraries
  • Http://www.sgi.com/tech/stl/ a lot of info, but remember: sgi stl is only similar to the C ++ standard library, it's not the same
  • Http://www.dinkumware.com/manuals/reader.aspx? Lib = CPP docs for the dinkumware implementation of the c ++ Library

PS: the header file is useless for translation. First, it does not feel necessary. Second, it is afraid that its level is limited and the translation is inaccurate.

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.