Re: [1/5] cmd: WCMD_delete: simplify logic, avoid assigning variable to itself
2 May
2011
2 May
'11
1:42 p.m.
On 2 May 2011 02:23, Dan Kegel <dank(a)kegel.com> wrote:
- if (attribute && !negate) { - stillOK = stillOK; - } else if (!attribute && negate) { - stillOK = stillOK; - } else { + if (attribute == negate) stillOK = FALSE; - } If you just write that as "if (!attribute == !negate)" you avoid both the assumption that TRUE is defined to 1 and the ugly "!= 0"'s. Or you could build actual attribute masks first and compare those instead, which may even be readable.
5430
Age (days ago)
5430
Last active (days ago)
0 comments
1 participants
participants (1)
-
Henri Verbeet