Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!batcomputer!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: Assignment in test: OK? Message-ID: <3749@goanna.cs.rmit.oz.au> Date: 13 Sep 90 09:51:20 GMT References: <1990Sep5.185451.25532@DRD.Com> <1990Sep12.194753.9808@laguna.ccsf.caltech.edu> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 29 In article <1990Sep12.194753.9808@laguna.ccsf.caltech.edu>, bruce@seismo.gps.caltech.edu (Bruce Worden) writes: > are legal, I don't see how `:=' is any better than just `='. People who > are used to thinking of `:=' as `equal' will type it as freely as we > type `='. But there _are_ no people who are used to thinking of ":=" as "equal". Algol 60, Algol 68, Pascal, Modula, Modula-2, Modula-3, MESA, Ada, BCPL, ... all use ":=" for assignment. Is there any well known language that uses ":=" for equality? Surely not. > Only something like Fortran's .EQ. is different enough to > draw attention to the two different meanings of `is equal to'. What "two different meanings"? Assignment is _not_ a meaning of "is equal to" and never has been. > I am not objecting to constructs like: > if((fd=open(path,flags,mode)) != NULL) You _should_. Assuming POSIX for open() and ANSI C for NULL, open() returns an int but NULL may be of type (void *). The real trouble would come if your C used the other ANSI-blessed value for NULL, namely 0. The error value for open() is -1, not 0. Use if ((fd = open(path, flags, mode)) != -1) { ... } -- Heuer's Law: Any feature is a bug unless it can be turned off.