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-21 13:03:49 PST Path: nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!pipex!uunet!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: 21 Jan 1995 21:03:49 GMT Organization: George Washington University Message-ID: <3frsrl$re5@cronkite.seas.gwu.edu> References: <3fo2ot$su2@miranda.gmrc.gecm.com> NNTP-Posting-Host: 128.164.9.3 X-Newsreader: TIN [version 1.2 PL2] Date: 1995-01-21T21:03:49+00:00 List-Id: R.A.L Williams (bill@valiant) wrote: : I think there are three reasons: : 1. It allows your code to be more compact. Many people think this is : a disadvantage, and so it is if the code will be read by comparative : novices, but it can improve readability to C experts who are : expecting such tricks. : : NB DONT confuse compactness with poor layout! I find that, for example: : : while ((c = getchar()) == ' ') { /* count spaces */ } : : is clearer than the 'expanded' alternative (to *me* :-). BINGO!!! Readability, like beauty, is in the eye of the beholder. An instructor here made the statement "Pascal is easier to read then C". I don't think so. In fact I got a D on a midterm because of it. I was the only person in my soph intro CS class using C instead of Pascal, so all the code fragments were in Pascal. To this day, I still can't read Pascal's pointer syntax. Readability is what you are familiar with. Both of the C code fragments are very familiar to me and I find *very* easy to read (except for the lack of white space in the first one). The same is true for Natural language. I can speak/read/write some Vietnamese. Vietnamese is a very regular language, and the spelling rules are never broken. The language is purely phonetic, making it quick to learn to pronounce words. However, I find English easier to read/write because of my added familiarity with English. And, it has even more warts than people state here about C. :-)) I am tired of novice C users always saying this construct is bad, and that construct is bad. And I don't care to program in C using only constructs that a novice would understand at first glance. Ours is a professional environment and certain level of proficiency should be expected. If a high school kid off the street could program like an expert, then why are we getting degrees and such? Writing ``for (p = head; p; p = p->next) { /* process list */ }'' Is quite clear to me, but others will probably disagree. But I find the way of reading a file in Ada to quite idiomatic. At least I was taught to enclose the reading from the file in a loop with an exception handler w/in the loop. When the exception would be raised when an attempt to read past EOF, then close the file and process what ever your read in. -- David O'Brien (dobrien@seas.gwu.edu)