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 16:24:13 PST Path: nntp.gmd.de!newsserver.jvnc.net!news.cac.psu.edu!news.pop.psu.edu!psuvax1!news.ecn.bgu.edu!newspump.wustl.edu!darwin.sura.net!gwu.edu!seas.gwu.edu!dobrien From: dobrien@seas.gwu.edu (David O'Brien) Newsgroups: comp.lang.ada Subject: Re: "Subtract C, add Ada" Date: 14 Jan 1995 00:24:13 GMT Organization: George Washington University Distribution: world Message-ID: <3f75jd$2tf@cronkite.seas.gwu.edu> References: <3etund$hnr@miranda.gmrc.gecm.com> <3f4mbe$rud@cronkite.seas.gwu.edu> <3f5s92$3id@info.epfl.ch> NNTP-Posting-Host: 128.164.9.3 X-Newsreader: TIN [version 1.2 PL2] Date: 1995-01-14T00:24:13+00:00 List-Id: Laurent Gasser (gasser@masg1.epfl.ch) wrote: : 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 choice 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. Yep, that's my point. The argument of character choice really isn't what is at the essence of the problem. Rather it is the language definition. : I never saw a good reason for allowing this. Simply the paradigm of C that *every* statement has a value. And C has no special logical values. So C has "values are values" akin to Ford's offering of the Model-T, "any colour you want, as long as it's black". I'm guessing Ritchie did this for the same reason as Henry Ford - to simply things. Which gave us the situation we have. In most languages the grammar would be: conditional_statement ::= if then Which in C becomes: conditional_statement ::= if ( ) and thus ``'' must include `` = ''. -- David O'Brien (dobrien@seas.gwu.edu)