I have a very simple suggestion for breaking out of nested loops.
Currently, there are a few ways of breaking out of multiple
nested loops but they all have unnecessary drawbacks:
- exceptions (performance penalty, complexity)
- using boolean flags that are checked in every iteration
(performa
I believe that auto has been redefined in C++11 as well. In
both, all it really
means is that the type is inferred.
That's what I seemed to remember as well. Originally it had
something to do with scope, but it was basically obsolete because
that was the default anyway, so nobody was using it.
I believe that auto has been redefined in C++11 as well. In
both, all it really
means is that the type is inferred.
That's what I seemed to remember as well. Originally it had
something to do with scope, but it was basically obsolete because
that was the default storage class anyway, so nobod
Isn't this what a do-while loop is for, or am I missing
something?
Well, yes, but then you don't need the regular "for" loop either.
After all, isn't that what a "while" loop is for?
The big advantage of "for" is that you can see at a glance what
the initialisation, condition(s) and incremen
I have a suggestion for D (which might make it into C/C++ as
well, but I thought D would be a more accessible place to suggest
it):
for(initializer; precondition; postcondition; increment)
would allow avoiding a useless comparison before the start of the
first iteration of a "for" loop in those