Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: == vs = Message-ID: <672@cresswell.quintus.UUCP> Date: 20 Feb 88 06:39:53 GMT References: <11523@brl-adm.ARPA> <909@micomvax.UUCP> <83@yendor.UUCP> Organization: Quintus Computer Systems, Mountain View, CA Lines: 40 While I can't bring myself to *like* the way C uses '=' to mean assignment (I mean, this is like using '+' to mean "call") I can live with it for a very simple reason: there are *lots* of programming languages other than C which do it. BASIC, COBOL, FORTRAN, PL/I, SNOBOL, ... PL/I is even worse than C, it *also* uses '=' for equality. C PL/I x = y = 0; x, y = 0; x = y == 0; x = y = 0; What is particularly galling is that BCPL used ":=" for assignment and "=" for equality, so the changeover must have been a deliberate choice of the more risky form. There isn't a snowball's chance that this aspect of C will be changed. And if it should be changed, then so should BASIC, COBOL, FORTRAN, PL/I, the Bourne shell, the C shell, and numerous others be changed. If you are concerned about it, it is trivially easy to write a preprocessor that scans a source file, replacing ":=" by "=" and reporting every solitary "=" as an error. (I've done it. Haven't used it in years.) That lint modification sounds even better. Anyone writing programs where human life is at stake should be using some other language than C, some very simple language where the emphasis has been on debugging, verifying, and understanding. (I'm afraid that ADA and Fortran 8X are on the wrong side of the complexity barrier for me.) That very simple language might very well be a subset of C, or mapped onto C. There is one very important thing which the ANSI C standard will buy us. It will now be possible for someone to write a portable "lint"; I am sick of not being about to check the CMS or VMS versions of my programs. This will make up for a lot of the remaining flaws in C, just as the PORT checker made up for a lot of the problems in Fortran. We've recently encountered -- checking printf() & friends -- checking for if (.. = ..) -- generating dANS prototypes from old code as desirable features of "new lint". What else can comp.lang.c readers come up with?