Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Synthetic 'unless' keyword Date: Thu, 04 Aug 2016 08:45:32 -0700 Organization: None to speak of Lines: 16 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="29100"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bEMuxMXlMUnO5JsnScURL" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:6+/EqZoFdIKVPwaj1q7vxM4Sywg= sha1:+Rz0o73Wkx+sOp+pqfXsxnWIWdE= Xref: csiph.com comp.lang.c:91652 Mark Storkamp writes: [...] > 'unless' goes back at least as far as BCPL, and I've used it like you > have a few times when it seemed appropriate. I don't understand why it > wasn't put into C, except that it isn't truly necessary (but then by > that argument, neither is the 'for' loop) The difference, I think, is that `unless` is *trivially* unnecessary. You can write the equivalent of a `for` loop using `while`, but it's verbose and easy to get wrong. `unless` just adds an implicit `!`. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"