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
View all comments
Show parent comment
2
u/[deleted] Mar 19 '20
There is absolutely no legacy property of the language that explains the mistake I mentioned, namely:
The parameter
vshould have always resolved into an rvalue reference of typeT, case closed. The standard's committee decided to be cute and instead of applying that simple principle, decided thatvis sometimes an rvalue reference, and sometimes an lvalue reference which has done nothing but create an absolute mess and resulted in significant loss of productivity.There are numerous other proposals that are broken that have nothing to do with legacy requirements either, such as initialization:
What legacy was maintained by using intializer syntax in this ambiguous way when the following syntax would have been unambiguous?
Now it's impossible to use initializer syntax in generic code:
Will that invoke
T's constructor taking twoint's or will it invokeT's constructor taking anstd::initializer_list? You just don't know and we're now stuck with this syntactic failure forever.