schung@cory.Berkeley.EDU (Stephen the Greatest) (05/25/87)
Sometimes you can compare languages. Say: "Is there anything that language A can do that language B cannot do?" Is there anything that Pascal and Ada can do and that C cannot do? Is there anything that C can do that Ada and Pascal cannot do? Is there anything that Pascal and Ada can do easily that C cannot? Is there anything that C can do easily that Ada and Pascal cannot? The answers seem to reconfirm my arguments. - Stephen
kolding@cory.Berkeley.EDU (Eric Koldinger) (05/25/87)
In article <2635@zen.berkeley.edu> schung@cory.Berkeley.EDU (Stephen the Greatest) writes: > > > "Is there anything that language A can do that language B cannot do?" > > Is there anything that Pascal and Ada can do and that C cannot do? >Is there anything that C can do that Ada and Pascal cannot do? Is there >anything that Pascal and Ada can do easily that C cannot? Is there anything >that C can do easily that Ada and Pascal cannot? There is one thing that is easy to do in Pascal-type languages that is very difficult in C. Write readable code. C programs have a tendency to be extremely wild concoctions of symbols such as: x=((fp->_flag&_READ)==0||(fp->_flag&(_EOF|_ERR))!=0); And that wonderful statment is out of an 'instructional' book. As for C's power, C can't do anything that Modula-2 (Pascal done right) can't, and Modula-2 code is, as a general rule, much easier to read than C. Part of the problem is probably the machismo that C programmers seem to have (I can reduce those twenty lines to two. So what if I'm the only one who can read them. Hope I don't forget what they do. Comments? Who needs 'em?). _ /| Eric \`o_O' kolding@cory.berkeley.edu ( ) "Ack Ack Ack" ucbvax!cory!kolding U Disclaimer: The University nevers listens to me anyways, but if they really want to claim these opinions, they're more than welcome to them.
schung@cory.Berkeley.EDU.UUCP (05/26/87)
In article <2638@zen.berkeley.edu> kolding@cory.Berkeley.EDU (Eric Koldinger) writes: > There is one thing that is easy to do in Pascal-type languages that is very >difficult in C. Write readable code. C programs have a tendency to be >extremely wild concoctions of symbols such as: > > x=((fp->_flag&_READ)==0||(fp->_flag&(_EOF|_ERR))!=0); > In C, you can define macros. Your statement can as well becomes: #define or || #define and & #define eof _EOF #define error _ERR #define flag fp->_flag #define read _READ x = ( ( flag and read ) == 0 ) or ( flag and ( eof and error ) ) <> 0 ); For a complicated statement, this is just as clean and as readable as Pascal, Modular 2, Ada will do it. - Stephen
gwyn@BRL.ARPA.UUCP (05/26/87)
The only problem with the C example you posted is that "x" was not a descriptive name; it would have been better to name the boolean something like bad_read. White space would help, too. I am curious how one could write this "more readably" in Modula-2. Any language appears unreadable to someone illiterate in it.
gwyn@brl-smoke.UUCP (05/27/87)
In article <2648@zen.berkeley.edu> schung@cory.Berkeley.EDU (Stephen the Greatest) writes:
- #define or ||
- #define and &
- #define eof _EOF
- #define error _ERR
- #define flag fp->_flag
- #define read _READ
Yeah, but don't do it; it makes the code less readable (to a skilled C
programmer).