Precedent for use of =

Chris Torek chris at umcp-cs.UUCP
Thu Jul 10 16:13:27 AEST 1986


>>In article <1645 at brl-smoke.ARPA> JUNG_E%SITVXA.BITNET at WISCVM.WISC.EDU writes:

Careful with the quotes; the `>>' text is mine, not JUNG_E%SITVXA.BITNET's.
(The >>> text is his.)

>>>Practically every language uses the equals sign, "=", to test for
>>>equality, not as an assignment operator.

(Here I listed some languages, and tallied:)
>>Well, 5 to 3 in favour of `= for equality', though APL and Mesa are
>>perhaps special cases: back-arrow is not available for assignment on
>>my H19.

In article <2158 at ihlpg.UUCP> tainter at ihlpg.UUCP (Tainter) replies:
>ADD:
>	Assignment		Equality
>	----------		---------
>				mathematics
>				logic
>--j.a.tainter

Imprimus, the context is really computer languages.  Secondus, both
mathematics and logic are very broad fields, and saying `mathematics
uses ``='' for equality' is like saying `physics uses ``c'' for
the speed of light': true in many instances but by no means universal.
Tertius, this whole discussion is getting boring.  For those of
you who prefer := for assignment and `=' for equality, just compile
all your C code to .o files with the following `pascalcc' shell
script.  It can be extended, if necessary, to do most everything
that /bin/cc does.

: pascalcc - compile C code with Pascal-esque assignment / equality
comp=/lib/ccom
c2=/bin/cat
tf=/tmp/pascalcc.$$
trap "rm -f $tf" 0 1 2 3 15
for i
do
	case "$i" in
	-O)	c2=/lib/c2;;
	-c)	;;
	*.c)	if cc -E "$i" |
		   sed -e 's/\([^:]\)=/\1==/' -e 's/:=/=/' |
		   $comp | $c2 > $tf; then
			if as -o `echo "$i" | sed -e 's/\.c$//'`.o $tf; then
				:
			else
				exit $?
			fi
		else
			exit $?
		fi;;
	*)	echo "$0: cannot handle file name \`$i'" 1>&2
		exit 1;;
	esac
done
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris at umcp-cs		ARPA:	chris at mimsy.umd.edu



More information about the Comp.lang.c mailing list