How does #include work in C++?


The <bits/stdc++.h> is a header file. This file includes all standard library. Sometimes in some coding contests, when we have to save time while solving, then using this header file is helpful.

In software engineering approach we should reduce the minimize the include. Using this header file, it will include lots of files, sometimes that may not be required in the program. So it may increase the compile time and program size. Some of the big disadvantages of this header file is listed below −

  • This <bits.stc++.h> is not a standard header file of GNU C++ library. So some compiler may fail to compiler source code with this header file.

  • Using this, it may require unnecessary longer time to compile.

  • As this is not a part of standard C++ library so it is non-portable

  • For this header file, every time the compiler tries to import the headers recursively every time the code is compiled.

Updated on: 30-Jul-2019

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements