home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / programm / 2405 < prev    next >
Encoding:
Text File  |  1992-08-20  |  1.6 KB  |  43 lines

  1. Newsgroups: comp.programming
  2. Path: sparky!uunet!utcsri!torn!watserv2.uwaterloo.ca!watserv1!mhcoffin
  3. From: mhcoffin@tolstoy.uwaterloo.ca (Michael Coffin)
  4. Subject: Re: Teaching the basics
  5. In-Reply-To: sdms@bnr.ca's message of 20 Aug 92 16:42:09 GMT
  6. Message-ID: <MHCOFFIN.92Aug20162507@tolstoy.uwaterloo.ca>
  7. Sender: news@watserv1.uwaterloo.ca
  8. Organization: Dept. of Computer Science, University of Waterloo
  9. References: <Bt6DGq.HuB@metropolis.com> <12635@anderson>
  10.     <ratner.714247759@ficus.cs.ucla.edu> <13226@bnr-rsc.UUCP>
  11. Date: Thu, 20 Aug 1992 21:25:07 GMT
  12. Lines: 29
  13.  
  14. In article <13226@bnr-rsc.UUCP> sdms@bnr.ca (Andrew Sterian) writes:
  15. > Hmmmm...I disagree on this one. It may have been true some years ago that 
  16. > the type checking etc. of Pascal made it easier on novice programmers but
  17. > the latest ANSI C compilers do just as good a job of it as Pascal.
  18.  
  19. I've heard this said with quite a bit of frequency lately, but it
  20. isn't true.  C compilers---even ANSI ones---don't do type
  21. checking across separately compiled files.  If I put the function
  22. prototype
  23.  
  24.         int f(double);
  25.  
  26. in one file and call f(3.14), the compiler is happy.  If I
  27. then put the function
  28.  
  29.         int f(int, char *) {... }
  30.  
  31. in another file, the compiler won't complain about that either.
  32. And I don't know of any C linkers that will complain.  If the
  33. programmer is lucky, the program will dump core; if not, who knows
  34. what may happen?
  35.  
  36. It is true that if you use a certain amount of discipline and make
  37. sure that the same prototype appears in both places---by putting it in
  38. an include file---the compiler will detect the error.  The problem is,
  39. there isn't any enforcement of this policy.
  40.  
  41. -mike
  42.  
  43.