Re: Deleting an element from a list in a loop
- From: Ulrich Eckhardt <eckhardt@xxxxxxxxxxxxxx>
- Date: Thu, 31 Aug 2006 09:25:19 +0200
Babak Pourat wrote:
Doug Harrison [MVP] wrote:
if ((*it)->ThreadFinished()) // Don't compare against true or false
Why ?
The point is this: If you use "some_result==true", this again yields a
boolean so in order to keep to your own standards, you would have to
write "(some_result==true)==true" and so on. Whenever you read something
like if(x), while(x) or for(..;x;..), you should know that x is a boolean
and how it is evaluated. Adding a redundant, explicit version of what is
done implicitly only clutters the code.
If, on the other hand, your code suffers in readability without the
comparison, you have a completely different problem. Adding a comparison
with 'true' doesn't really help then but at best work around this lack of
readability. In that case, you should rename some things so that the logic
becomes more apparent.
Uli
.
- References:
- Deleting an element from a list in a loop
- From: Andrew Chalk
- Re: Deleting an element from a list in a loop
- From: Doug Harrison [MVP]
- Re: Deleting an element from a list in a loop
- From: Babak Pourat
- Deleting an element from a list in a loop
- Prev by Date: Re: Deleting an element from a list in a loop
- Previous by thread: Re: Deleting an element from a list in a loop
- Index(es):
Relevant Pages
|