Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
clishem
· 9y ago · 0 comments
Never give advice without telling why, because it's very likely that people will forget it if they don't understand your advice.
Comments
[–]
thecpphorse
9y ago
Ok.
auto i{42}; // std::initializer_list<int>
[–]
hellofunk
9y ago
No longer applies with c++17
[–]
slavik81
9y ago
More info about this:
http://stackoverflow.com/q/25612262/331041
[–]
pjmlp
9y ago
While you are correct, many companies are now just transitioning into C++11, so knowing this will be relevant for the next decade at least.
[–]
david-given
9y ago
But why is that bad?
[–]
lmitchell
9y ago
Because `i` isn't an int, it's an initializer_list, and you almost never want to actually create an initializer_list instead of an int? Seems pretty understandable to me.
[–]
thecpphorse
9y ago
It's unexpected. Nobody ever* wanted to assign an initializer list to a named variable.
[*] pretty much