Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Range-aware modulo operator -% Date: Wed, 02 Jan 2019 00:38:57 -0800 Organization: None to speak of Lines: 30 Message-ID: References: <9RxWD.81420$N45.2557@fx21.am4> <65TWD.67453$Ab5.11301@fx04.am4> <0tVWD.263283$DWh1.99504@fx36.am4> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader01.eternal-september.org; posting-host="4d2fb03eb8a6f1b5fb918b8f9f106071"; logging-data="12114"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18n1UrcXbWbHpblLiVvAHPN" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:f7T+ota7gnEQpPTAeTcvXAhG4wc= sha1:V3i6j0kNUDOSzPIWteFaaJ13+L4= Xref: csiph.com comp.lang.c:139356 Bart writes: [...] > There are several approaches to describing what is happening. The > language reference necessary has to choose one. That doesn't mean it > is the only possible one. (Think about that when next quoting chapter > and verse.) Sure. Why would you not at least look at what the standard says before making up your own description *that doesn't improve on what the standard already says*? > And if you take it literally, it means that: > > if (a==b && c==d) > > needs to treated as though it was written as: > > if ((a==b && c==d) != 0) > > Although this will work, it is also unnecessary. With my approach, the > if-expression must be 0 or 1, and the result of && is already 0 or 1. Of course it's unnecessary. Read N1570 5.1.2.3p4, and feel free to take it literally. -- Keith Thompson (The_Other_Keith) kst@mib.org Will write code for food. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"