Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: My C program does not compile or gives segmentation fault Date: Mon, 27 Mar 2017 16:21:04 -0700 Organization: None to speak of Lines: 40 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="621a15f5f24560a56e85ad6532f35357"; logging-data="8922"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18JuQzC97HHZ0bjJS4pfCnn" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:jhmPneJj6I0kSPiUm/hQMIL48jY= sha1:x0z6rFlARiFC4I8SlLQMnnQIaDg= Xref: csiph.com comp.lang.c:107229 Ike Naar writes: > On 2017-03-27, Keith Thompson wrote: >> By contrast, `3 == x` seems like a statement *about 3*. > > No. Yes. I wrote that it *seems* like a statement about 3. That's a statement about my perception of it (and, I think, that of a lot of other people). > When K&R designed the == operator they obviously had an > operator in mind that tested for the equality of its operands. > I really don't think that if one of those operands were 3 and > the other one were x, the == expression would suddenly lose it's > original meaning an turn into a statement about the 3. Of course they didn't. We all know that == is commutative, and that `x == 3` has the same semantics as `3 == x`. Any argument based on the assumption that we're not perfectly well aware of that is likely to be invalid. I know what `x == 3` and `3 == x` mean in terms of C semantics. And I know which one I prefer and find more natural and easier to read. I don't expect to convince anyone that my perception is right and theirs is wrong. Indeed, if you really don't have a preference one way or the other, then your intuition is closer to the C semantics than mine is. > I also don't think they had characters from the Star Wars movie in > mind when they designed the == operator. ? -- 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"