Thư viện bits/stdc++.h là gì, cách biên dịch các file c++ nhanh hơn

For every Header tệp tin , I was taught something like a full size denoting a purpose of its call

For Example:


Bạn đang xem: Thư viện bits/stdc++.h là gì

#includemeant include C standard input output files

#includemeant include input output streams


meant include C math files for mathematical operations

In the same manner for

#includewhat is the full form or basically how its name tells us about the files being included ?

it like

include bits/ standard library of c++

what"s meaning of bits and also what"s the significance of / in header tệp tin name

and one more thing lớn be clarified is

in modern C++ compilers, addition of .h for any other header file is not allowed but how its allowed here ?

giới thiệu
Improve this question
edited Jun 14, 2021 at 9:05
asked Jun 14, 2021 at 8:53
463035818_is_not_a_number yeah.. Even in c++ too #include means include input and output streams và so on ...... I have taken only C examples as.h is present in C header files
Jun 14, 2021 at 8:58
| Show 16 more comments

1 Answer 1

Sorted by: Reset to default
Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first)
It"s not a predefined tệp tin actually và name doesn"t have meaning except it was made intentionally distinctive. It could be decoded as "standard C++" which is as misguided as it may get. Name itself appearance is contemporary khổng lồ appearance of Morozov"s STL library, so it may related lớn namespace std. I can call a tệp tin or , that"s just the same.

Historically that file was included into examples of some C++ guides , essentially replacing all required includes and declarations with one-liner. Usually there was description of that file somewhere or how to lớn replace that line, some books included floppy or CD. The content of file is not agreed upon, but usually it included all headers used in examples. Sometimes it contains using namespace std; line. In some cases there are some type definitions, that was typical for versions that predate C++983, e.g. Before stdint.h cstdint was present.

The thing is, the C++ language appeared in 1987 with first implementations available as early as 1988, but standard appeared only in 1998. Before that every compiler had some quirks, implemented one or or another feature differently, had alternative names for headers. STL appeared in 90s & was an "external" library. C++primers usually were mentioning which proprietarycompiler they are compatible with or offered danh sách of compatible versions. The header would make it easier by creating "standard" environment for every implementation in which all book"s examples và exercises will work.

Xem thêm: Đọc Sách Tư Duy Ngược Online, Tư Duy Ngược Dịch Chuyển Thế Giới

That"s history of the name.

Afaik GNU environment may include that because it was used in tests and for creation of precompiled headers. E.g., this is content of file for libstdc++ run-time included with GCC 4.8. You can see #ifdef that separates C++11 headers from C++98. Leter there appears more.

But not every platform with C++ compiler, not every GCC flavor may have access to this tệp tin as a part of libstdc++ run-time library, lớn which this name is linked today. Presence of using namespace std; in some non-GNU versions makes them dangerous and content of file changes from version to version.

Greatest disadvantage of using that tệp tin is portability. There is also concern of using it without precompiling headers, because the nội dung of whole standard library is huge (around a million lines & growing) và adds compilation time. In a big projects that may add minutes and hours of time to compile.

Nếu là dân competitive programming áp dụng C++ để code, có lẽ rằng cậu đã từng có lần "ồ", "wow", hụ hét khi được khai sáng sủa với thư viện

Leave a Reply

Your email address will not be published. Required fields are marked *


Welcome Back!

Login to your account below

Retrieve your password

Please enter your username or email address to reset your password.