Why so many students are using '#include<bits/stdc++.h>' instead of '#include<iostream>'?
I am hiring for my company. And the codes submitted for a test problem has '#include<bits/stdc++.h>' at the beginning. The MacOS default compiler complains
main.cpp:1:9: fatal error: 'bits/stdc++.h' file not found
#include<bits/stdc++.h>
^~~~~~~~~~~~~~~
1 error generated.
Why people are using '#include<bits/stdc++.h>'?
225
Upvotes
185
u/[deleted] Mar 19 '20
Because they are mostly folks who are coming in via competitive programming backgrounds and/or most of the C++ stuff they saw comes from websites like geeksforgeeks, where other competitive programmers write algorithm tutorials in C++ using patterns like this.
I have said it once and I have said it before, if a candidate's exposure to C++ is only through competitive programming or leetcode, then their C++ experience is not to be taken seriously. They may know some things about the STL, their concepts like OO, templates, move semantics, memory management, concurrency, build systems, testing i.e stuff that actually matters in a production C++ environment, are seriously lacking or non-existent.
I took a guess that you're from India, and well, looks like you are, this is very prevalent there.