Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site wateng.UUCP Path: utzoo!watmath!wateng!ksbszabo From: ksbszabo@wateng.UUCP (Kevin Szabo) Newsgroups: net.lang.c,net.lang.pascal Subject: Re: PASCAL as a systems programming langugage Message-ID: <1854@wateng.UUCP> Date: Sun, 13-Jan-85 22:45:36 EST Article-I.D.: wateng.1854 Posted: Sun Jan 13 22:45:36 1985 Date-Received: Mon, 14-Jan-85 04:24:47 EST References: <282@harvard.ARPA> <7211@brl-tgr.ARPA> <571@vu44.UUCP> Reply-To: ksbszabo@wateng.UUCP (Kevin Szabo) Distribution: net Organization: VLSI Group, U of Waterloo Lines: 59 Xref: watmath net.lang.c:3864 net.lang.pascal:187 Summary: In article <571@vu44.UUCP> jack@vu44.UUCP (Jack Jansen) writes: ( editted quite a bit by me, Kevin Szabo ) > Ok, let me throw in my $1E-1 worth of opinion. > Well, what I like most about pascal is that it *works*. > By this, I mean that if a C program takes an hour to write > and a pascal program 2 hours, the pascal program is debugged > in 20 minutes, and the C program in 2 days. > I have seen this also with friends of mine, so I don't think it > can be influenced by a difference in experience or other personal > factors, I think that pascal, by *forcing* you to define your > data, parameters, etc. correctly points you to a lot of logic errors > (and typing errors), where C will have you addicted to coffee and > tobacco by the time you locate the missing &. I agree whole heartedly that forcing the programmer to define data, parameters etc. will improve correctness in code. Actually in a recent note to the mod.standard-c newgroup I suggested adding stronger typing to C, as well as some other goodies. Of course the moderator (quite rightly and wisely) pointed out that this fell into the class of additions to C, and thus did not belong in the standard. He also pointed out that check programs, such as lint, are not part of the standard and hence could enforce strict type checking for those that so wished. This holds great promise for me since I like C but I also like the compiler to tell me when I have been stupid and passed the wrong type of argument to a function. I had previously hoped that typedef's would allow me to create my own types that would be checked by lint, but presently they are only aliases which are immediately promoted to their basic type when encountered. Hence they do not pick up errors such as: typedef foo int; /* These typedefs might be wrong */ typedef bar int; main() { foo a; bar b; get_a_and_b( &b, &a ); .... } get_a_and_b( a, b ) foo *a; bar *b; { }; Sooo... if anybody out there in net-land is hacking away at LINT you could possibly try adding a `super typechecking' option (that has to be explicitly turned off!). I suggest that it strictly enforces type checking when calling functions and, in order not to be innudated with billions of warnings, it will promote the derived type (foo) to its basic type (int) whenever mixed arithmetic is attempted. (mixed arithmetic in the sense of typea = typeb + typec; the Derived types) It doesn't effect CC but allows the disciplined programmer the type checking that s/he requires. What say ye? Kevin -- Kevin Szabo watmath!wateng!ksbszabo (U of Waterloo VLSI Group, Waterloo Ont.)