> On Tuesday 22. October 2013 18.01.10 Werner Almesberger wrote: > > [ Came across a security-related article that made me think of an > > old and constant gripe of mine. Here's my rant, somewhat off-topic. ] > On Tue, Oct 22, 2013 at 07:11:56PM +0200, Paul Boddie wrote: > For example: > > good_to_go = (a > 10) || (a == 0);
You realize you're doing exactly what Werner just told you not to do, right? ;-) > There is also Rule 12.5, that applies specifically to logical operators. > It says, that the operands of logical && or || shall be primary > expressions. There is an exception that if there is a sequence of > only logical && of only logical ||, then extra parentheses are not > required. I really dislike that. In logics, "or" is written as addition and "and" as multiplication (and that mostly makes sense, too, if you consider booleans as 1-bit integers). Being used to that, there is no confusion at all about the precedence; of course multiplication comes before addition. I am slightly annoyed by the compiler warnings telling me to add parentheses to those expression when IMO there's nothing unclear abou them. Now that I read Werner's post, I'm even more convinced that they not only serve no purpose, but are actually harmful. Thanks, Bas
signature.asc
Description: Digital signature
_______________________________________________ Qi Hardware Discussion List Mail to list (members only): [email protected] Subscribe or Unsubscribe: http://lists.en.qi-hardware.com/mailman/listinfo/discussion

