🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1528

Re: := versus ==

#1528
From: Dan Bernstein
Date: Sun, 19 Aug 1990 14:03
24 lines
1585 bytes
In article <:1=4K26@ggpc2.ferranti.com> peter@ficc.ferranti.com (Peter da Silva) writes:
> In article <3989@rtifs1.UUCP> trt@rti.rti.org (Thomas Truscott) writes:
> > I like the Q and PL/M features, but they don't stop me from typing:
> > 	a == b + 1;	/* OOPS, I mean't to assign to a */
> PL/M will. A naked expression is not a legal PL/M statement.

It's legal in Q, but the compiler gives you a warning. That's the
biggest advantage of having both := and = for assignment: the compiler
can reasonably check that every value is used, without special-casing
equality the way C compilers do.

> > 	if (a := b) ..	/* OOPS, I only wanted to compare them */
> I think that is only legal is a and b are booleans.

This is legal in Q, but again the compiler gives you a warning.

> If I was god and got to fix C, I'd make the indirection operator postfix
> before playing with assignment and equality.

Right now, Q accepts both *p/&x and p^/x@. The macro processor should
end up powerful enough to eliminate two of the four from the base
language.

---Dan
Technical Details
Message-ID: <2538:Aug1914:03:0790@kramden.acf.nyu.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!husc6!cmcl2!kramden.acf.nyu.edu!brnstnd
References: <7H+4AM6@xds13.ferranti.com> <3989@rtifs1.UUCP> <:1=4K26@ggpc2.ferranti.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!husc6!cmcl2!kramden.acf.nyu.edu!brnstnd
From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein)
Newsgroups: comp.lang.misc
Subject: Re: := versus ==
Message-ID: <2538:Aug1914:03:0790@kramden.acf.nyu.edu>
Date: 19 Aug 90 14:03:07 GMT
References: <7H+4AM6@xds13.ferranti.com> <3989@rtifs1.UUCP> <:1=4K26@ggpc2.ferranti.com>
Sender: brnstnd@kramden.acf.nyu.edu (Dan Bernstein)
Organization: IR
Lines: 24