Re: [PATCH] coverity: CID35: fixed wrong condition
Marcus Meissner wrote:
- if(nRelPos>=0) { /* if this or preceding row */ + if(nRelPos<=0) { /* if this or preceding row */ while(nRelPos<=0) {
Shouldn't that become a "do { ... } while()" then?
On Mon, Feb 05, 2007 at 10:29:23PM +0100, Felix Nawothnig wrote:
Marcus Meissner wrote:
- if(nRelPos>=0) { /* if this or preceding row */ + if(nRelPos<=0) { /* if this or preceding row */ while(nRelPos<=0) {
Shouldn't that become a "do { ... } while()" then?
No, since there is a return item; after the while () loop. Actually we might want to kill the whole function, it seems not to be used. I am just not comfortable with removing it. Ciao, Marcus
Marcus Meissner wrote:
- if(nRelPos>=0) { /* if this or preceding row */ + if(nRelPos<=0) { /* if this or preceding row */ while(nRelPos<=0) { Shouldn't that become a "do { ... } while()" then? No, since there is a return item; after the while () loop.
I meant replacing just the while(), not the if() while(). It's mostly a matter of style though as gcc most likely will compile it to a do {} while() anyway. Felix
On Tue, Feb 06, 2007 at 07:20:40PM +0100, Felix Nawothnig wrote:
Marcus Meissner wrote:
- if(nRelPos>=0) { /* if this or preceding row */ + if(nRelPos<=0) { /* if this or preceding row */ while(nRelPos<=0) { Shouldn't that become a "do { ... } while()" then? No, since there is a return item; after the while () loop.
I meant replacing just the while(), not the if() while().
It's mostly a matter of style though as gcc most likely will compile it to a do {} while() anyway.
I only wanted to do the minimalistic change to avoid errors creeping in ;) Ciao, Marcus
participants (2)
-
Felix Nawothnig -
Marcus Meissner