William "Chops" Westfield wrote: > On Mar 11, 2008, at 9:49 AM, Walter Banks wrote: > >> Double braces don't solve the underlying problem > > We had this gem (I think I've sanitized it enough for "the public") > > if (match_number(csb, 0, MAXUSHORT, &i, var2, flags, NULL) && > match_char(&csb->line[csb->line_index], &i, ':') && > ((got_num_colon = TRUE)) && /* Remember we got ":" */ > match_number(csb, 0, MAXULONG, &i, var3, flags, NULL) && > match_whitespace2(...)) { > /* Stuff */ > return; > } > > No amount of multiple parens made a new compiler happy about that line > with "got_num_colon" in it. And there was about a 50% chance that the > person fixing it would fix it wrong, even with the comment... Usually warnings of this sort get fixed not by multiple parentheses but by creating an expression that is not a statement; maybe something like this: if (match_number(csb, 0, MAXUSHORT, &i, var2, flags, NULL) && match_char(&csb->line[csb->line_index], &i, ':') && ((got_num_colon = TRUE) != 0) && /* Remember we got ":" */ match_number(csb, 0, MAXULONG, &i, var3, flags, NULL) && match_whitespace2(...)) { /* Stuff */ return; } Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist