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: Readabilty of "3 == x" (was: My C program does not compile or gives segmentation fault) Date: Tue, 28 Mar 2017 09:20:50 -0700 Organization: None to speak of Lines: 29 Message-ID: References: <89549322-236e-4a59-9bb5-dc881593a846@googlegroups.com> <1b709495-03da-462d-926f-3ee2be0a7ab5@googlegroups.com> <58d642e0.2297265@news.xs4all.nl> <58d6e0b3.20124312@news.xs4all.nl> <874lye5usl.fsf@bsb.me.uk> <871stixs6f.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="621a15f5f24560a56e85ad6532f35357"; logging-data="2469"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DxsRh8QvS5kkhcR9FluAg" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:46Gv7magmRYxsFfDaJHMlZzmNh4= sha1:s15EAixSD8mkDjm0+Uk+3W6f1aA= Xref: csiph.com comp.lang.c:107277 ram@zedat.fu-berlin.de (Stefan Ram) writes: [...] > In my teaching, I sometimes observe that participants oppose > if heads such as > > if( x ) > > . This seems to be so because in English (in my courses, > actually, "in German") one cannot just say "if x,", but has > to say "if x is not equivalent to zero," or some such. So, > they expect that the rules that govern the English language > also should apply to C. That depends on what x is. If a name is used as a condition, it should probably be a name that makes sense as a condition. I probably wouldn't literally write if (x) but I might write if (done) or if (job_is_completed) which reads naturally as an English-like phrase. I certainly wouldn't read `if (done)` as `if done is not equal to zero`. -- 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"