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,comp.lang.c++ Subject: Re: Range-aware modulo operator -% Date: Mon, 31 Dec 2018 16:44:35 -0800 Organization: None to speak of Lines: 18 Message-ID: References: <9RxWD.81420$N45.2557@fx21.am4> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader01.eternal-september.org; posting-host="a1e3a0589224a2dccf0492cf179df393"; logging-data="24981"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/FtIZfi0ugjHqbYTMROLzI" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:UALmzahR6eMvRkJ71rwoy/e4ZSY= sha1:impGbtYsfx1ek7qeVwHt8xC4mjg= Xref: csiph.com comp.lang.c:139311 comp.lang.c++:62681 Bart writes: [...] > If you write if(x), while(x), or for(;x;), then it automatically applies > the effective equivalent of !! to give a true (x!=0) or false (x==0) > result. (The same with (x && y) and any such combinations.) [...] That's one way to describe it. It's now how the standard describes it. For example, the description of the "if" statement says "the first substatement is executed if the expression compares unequal to 0", which I find clearer and simpler than your reformulation. -- 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"