On Fri Dec 12 0:58 , Michael Stefaniuc sent:
Andrew Talbot wrote:
What is wrong with this patch, please?
If I may venture a guess: You have replaced a nice and concise for loop into and ugly 4 line while loop.
bye michael
Hi Michael,
Ugly? Andrew Koenig and Barbara Moo show a similar construct in their book "Accelerated C++". ;)
But how would you then fix the sign-compare violation, or would you just let this one go?
Ugly? Andrew Koenig and Barbara Moo show a similar construct in their book "Accelerated C++". ;)
A little off topic, but this is on page 19, before for loops are introduced. If you look ahead to page 27 (2.5.2) that example is redone with a for loop.
Chris.
Andrew Talbot wrote:
On Fri Dec 12 0:58 , Michael Stefaniuc sent:
Andrew Talbot wrote:
What is wrong with this patch, please?
If I may venture a guess: You have replaced a nice and concise for loop into and ugly 4 line while loop.
Ugly? Andrew Koenig and Barbara Moo show a similar construct in their book "Accelerated C++". ;)
Too bad that I'm not reading that book at the moment but "The Practice of Programming" and that book disagrees with that ;)
But how would you then fix the sign-compare violation, or would you just let this one go?
I had to look twice as the initial warning was in a for loop above: Either leave it as is for now as the warning is bogus or at least add the decrement directly to the while like this: i = sizeof(MMDrvs) / sizeof(MMDrvs[0]); while (i-- > 0) { MMDRV_ExitPerType(&MMDrvs[i], MMDRV_AUX);
Though the later would still have to pass Alexandre's review.
bye michael
But how would you then fix the sign-compare violation, or would you just let this one go?
If you want it to be more compact:
unsigned int i;
...
for (i = sizeof(foo) / sizeof(foo[0]) - 1; ~i; --i)
Tested? No. Readable? Don't ask me... :-)
Cheers, Peter