3 ms·
"Code should be written in a way it is more readable, not shorter." Personally I think sometimes shorter code, that gets rid of unnecessary bureaucracy, is mor
by fsloth 9y ago
"Code should be written in a way it is more readable, not shorter."
Personally I think sometimes shorter code, that gets rid of unnecessary bureaucracy, is more readable. For example, C++ recently (in the past decade...) gained range based iteration.
Previously:
for(containe_type::iterator i = my_container.begin(); i != my_container.end(); i++){
do_stuff(i);
}
Now:
for(auto& i : my_container)
{
do_stuff(i);
}
This is really context sensitive. Some code benefits from verbosity while other don't.