Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.lang.misc Subject: Re: := versus == Message-ID: <7H+4AM6@xds13.ferranti.com> Date: 1 Aug 90 13:57:54 GMT References: <1990Jul30.143530.24295@phri.nyu.edu> <25684@cs.yale.edu> <=L-4T-A@ggpc2.ferranti.com> <17559:Aug101:50:5290@kramden.acf.nyu.edu> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC Lines: 23 In article <17559:Aug101:50:5290@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: > Q has a better solution. > a == b is for comparison. Its value is 1 if they're equal, 0 if not. > a := b is for assignment. It sets a to b and has value a. > a = b is for assignment. It sets a to b and has no value. Good idea. PL/M (a language with otherwise very little to recommend it) does something like this (a = b is still for comparison), though it adds the syntactic sugar: a, b, c = d which is equivalent to: a = b := c := d Interestingly, the PL/M-286 users guide follows this section with a BIG BLACK BOX warning that: a = (x := x + 4) + y * y + x is ambiguous and "The results depend on too many factors, e.g. the optimisation level you specify to the compiler." -- Peter da Silva. `-_-' +1 713 274 5180. 'U`