Deutsch English Français Italiano |
<vb42gn$1gbbm$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Bart <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: on changing paradigm of assign call Date: Mon, 2 Sep 2024 11:03:03 +0100 Organization: A noiseless patient Spider Lines: 34 Message-ID: <vb42gn$1gbbm$2@dont-email.me> References: <ec5339abbc9920049b4f4b79a62ca2702df730e6@i2pn2.org> <vb35b0$1qeok$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 02 Sep 2024 12:03:04 +0200 (CEST) Injection-Info: dont-email.me; posting-host="5aba6719cfbcb81fa74e87ed5976fcca"; logging-data="1584502"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18NhVWtE9z7M50h4wVLHu/y" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:jxcE9HAm+mKBXy5e+5t0gw7nPKs= Content-Language: en-GB In-Reply-To: <vb35b0$1qeok$1@dont-email.me> Bytes: 2410 On 02/09/2024 02:45, Lawrence D'Oliveiro wrote: > On Sun, 01 Sep 2024 16:15:37 +0200, fir wrote: > >> int x = foo() >> >> annoying is especially this "=" sign as this is not quite assignment >> imo > > The original symbol as used in Algol-like languages was “:=”. While C > copies quite a few features from the Algol family, it made the > questionable decision to shorten the assignment operator to “=”, > ostensibly to save typing. Which meant they had to invent a different > symbol, “==”, to denote an equality comparison. The original symbol in FORTRAN, which came before Algol, was "=" for assignment (and .EQ. for equality) BASIC, which came long before C, used "=" for both. It could do that because it didn't allow assignment inside an expression. (Meanwhile I use '=' for equality, for defining new named entities, and for compile-time assignments. Runtime assignments used ':=': static int a = 100 # inside function int b := 200 The line is blurred a little in dynamic code when some '=' assignments need to be done as execution starts. In C though it gets confusing using the same symbol for each; static int a = 100; // Initialised once only (and likely before // execution starts) int b = 200; // Initialised every time it is encountered)