<bits/stdc++.h> header file in C++
It is basically a header file that includes every standard library. In programming, people focus more on finding algorithm to solve a problem than on software engineering. From, software engineering perspective, it is a good idea to minimize the include. It actually includes a lot of files, which your program may not need, thus increases both compile time and program size unnecessarily.
Advantages of bits/stdc++
- In contests or interview test, using this header file is a good idea, when you want to reduce the time wasted in doing chores; especially when your rank is time sensitive.
- Since this header file contains all header files so there is no need to include any other.
- You don’t have to remember all the STL of GNU C++ for every function you use.
Disadvantages of bits/stdc++
- Using it would include a lot of unnecessary header files which might be not in use and increases compilation time.
- This header file is not part of the C++ standard, is therefore non-portable, and should be avoided.
- bits/stdc++.h is not a standard header file of GNU C++ library. So, if you try to compile your code with some compiler other than GCC it might fail.
The bits/stdc++.h is a header that is included in order to include all standard libraries. In other word including bits/stdc++.h includes every standard library you want. This is quite helpful in situations when you want to waste time including different header files. But on the other hand including this header file results in inclusion of many unnecessary files which increases compilation time.