Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: = vs. == (again!) (Was: c needs this sign)
Date: Wed, 14 Oct 2026 23:36:19 -0700
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <86jynjqxlo.fsf@linuxsc.com>
References: <117mfle$3aage$1@dont-email.me> <117om5f$2eem$1@dont-email.me> <117on5c$2qpg$1@dont-email.me> <117ophj$3il1$1@kst.eternal-september.org> <117p6mi$229km$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Thu, 15 Oct 2026 06:36:22 +0000 (UTC)
Injection-Info: dont-email.me; logging-data="2272892"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX183bXLh094vTgksEUF68ofALvHcJSlLZI4="; posting-host="8e248dd53a94b2a901695ff9f1057f0e"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:PrOGheRo/BTRDik4CDqHhynQnnM= sha1:yPuSgPfCpDvCliY/dbpio17jWtk= sha256:GBztAtIYEvFl7PuTEVk2w6L0p1WUZRvE4yVJThL2s6w= sha1:O/DbAd4UDkVnzXZP/Q8H6T+6VxU= sha256:oTHRdmVEwaoUWwPS4N0u4DDfhCRWrFR+fH/NHwGHRCY=
Xref: csiph.com comp.lang.c:403177
gazelle@shell.xmission.com (Kenny McCormack) writes:
> In article <117ophj$3il1$1@kst.eternal-september.org>,
> Keith Thompson wrote:
> ...
>
>> If I were creating a new language, I might use ":=" for assignment
>> and "==" for comparison. I'd use "==" rather than "=" only to
>> cater to programmers accustomed to C and the languages it influences.
>> And I'd discuss that language elsewhere.
>
> Note that another way to solve this problem is simply to not allow
> assignments to be expressions. This has been suggested at various
> times in the past on this newsgroup.
>
> The fact that assignments are expressions is one of the nifty
> features of C (and C-like) language(s) and allows for nifty,
> clever, compact code that is dazzling to the eye (and confusing
> to the newbie). [...]
They also can be used in ways that are straightforward, not hard
to understand, and not confusing to new programmers. Like most
aspects of programming languages, using assignment expressions
effectively requires a certain amount of taste and good judgment.
If every potentially confusing language feature were thrown out
there would be almost nothing left.