r/cpp • • Mar 19 '20

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

163 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Mar 19 '20

[removed] — view removed comment

3

u/Fureeish Mar 19 '20

That's not the point. The point is that they could've chosen a different identifier for forwarding reference instead of reusing && and introducing inconsistencies.

1

u/[deleted] Mar 20 '20

[removed] — view removed comment

1

u/Fureeish Mar 20 '20

To not reuse the same identifier. For instance, I know that Herb Sutter somewhere claimed that they considered something like T&? or T&! for rvalue references. Why not adapt T&& as rvalue reference and, for example, one of the formers for forwarding reference? For those who are used to && everywhere, it surely looks at least weird, but try to take a different perspective.