On Jun 25, 2011, at 3:22 PM, Jon Cruz wrote:
For example, this line you touched could be improved by spacing it thusly
&&((l!=NULL&&!edge->isEnd(l->id))||l==NULL) && ((l != NULL && !edge->isEnd(l->id)) || l == NULL)
Suddenly that makes the logic and the referencing easier to read and follow. It also gives more visibility to areas that could be made clearer with more parenthesis:
&& (((l != NULL) && !edge->isEnd(l->id)) || (l == 0) )
if I compare those right on top of each other, the legibility change should show up:
&&((l!=NULL&&!edge->isEnd(l->id))||l==NULL) && (((l != NULL) && !edge->isEnd(l->id)) || (l == 0) )
Or to take this refinement a bit further (as ScislaC commented in IRC), one could fold out the other NULL
&& (((l != NULL) && !edge->isEnd(l->id)) || (l == 0) ) && (((l != 0) && !edge->isEnd(l->id)) || (l == 0) )
Then again, the test against NULL/0 is not required in C/C++
&& ((l && !edge->isEnd(l->id)) || !l )
but I can't read that in this font, so I'll do a before and after with a new name:
&&((el!=NULL&&!edge->isEnd(el->id))||el==NULL) && ( (el && !edge->isEnd(el->id)) || !el )