From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1d321b3a6b8bcab2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-13 12:53:11 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!ix.netcom.com!netcom.com!milod From: milod@netcom.com (John DiCamillo) Subject: Re: "Subtract C, add Ada" Message-ID: Organization: NETCOM On-line Communication Services (408 261-4700 guest) References: <3etund$hnr@miranda.gmrc.gecm.com> <3f4mbe$rud@cronkite.seas.gwu.edu> <3f5s92$3id@info.epfl.ch> Date: Fri, 13 Jan 1995 20:53:11 GMT Date: 1995-01-13T20:53:11+00:00 List-Id: gasser@masg1.epfl.ch (Laurent Gasser) writes: >In article <3f4mbe$rud@cronkite.seas.gwu.edu>, dobrien@seas.gwu.edu (David O'Brien) writes: >|> R.A.L Williams (bill@valiant) wrote: >|> : My experience of writing software and running software projects in C >|> : highlights four common low-level C errors: >|> : 1. = instead of == and vice versa >|> >|> I have to wonder. What if C defined the logical equals operator to be >|> "=" and the assignment operator to be ":=" just like Ada, Algol, Pascal, >|> Modula-x, etc? Would this error still exist??? >The problem is in the language definition, not in the choic of symbols. >C is one of the rare language I use to allow having an assignment after >the if statement. All other languages only allow for a boolean test. >I never saw a good reason for allowing this. Huh? It falls naturally out of two other C rules: 1) an assignment is an expression whose value is equal to that of the thing being assigned, 2) any expression that evaluates to integer 0 is false, all other expressions are true. C would have required a special restriction to prevent assignment in an if-test. (Note that assignment in a loop-test is a useful and common idiom in C.) That said, if this error is anyone's biggest concern about developing software in C, then that person has not really tried to develop software in C. All lan- guages have warts, even Ada. -- ciao, milo ================================================================ John DiCamillo Pinin' for the fjords? milod@netcom.com What kind of talk is that?