• Re: = vs. == (again!) (Was: c needs this sign)

    From Tim Rentsch@[email protected] to comp.lang.c on Wed Oct 14 23:36:19 2026
    From Newsgroup: comp.lang.c

    [email protected] (Kenny McCormack) writes:

    In article <117ophj$3il1$[email protected]>,
    Keith Thompson <[email protected]> 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.
    --- Synchronet 3.22a-Linux NewsLink 1.2