home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / programm / 2414 < prev    next >
Encoding:
Internet Message Format  |  1992-08-20  |  2.2 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!aplcen.apl.jhu.edu!anagld!sammy
  2. From: sammy@anagld.analytics.com (Sam Blackburn)
  3. Newsgroups: comp.programming
  4. Subject: Re: Teaching the basics
  5. Message-ID: <1582@anagld.analytics.com>
  6. Date: 21 Aug 92 00:47:18 GMT
  7. References: <Bt6DGq.HuB@metropolis.com> <12635@anderson>     <ratner.714247759@ficus.cs.ucla.edu> <13226@bnr-rsc.UUCP> <MHCOFFIN.92Aug20162507@tolstoy.uwaterloo.ca>
  8. Organization: Computer Sciences Corporation - Systems Engineering Division
  9. Lines: 41
  10.  
  11. mhcoffin@tolstoy.uwaterloo.ca (Michael Coffin) writes:
  12.  
  13. >In article <13226@bnr-rsc.UUCP> sdms@bnr.ca (Andrew Sterian) writes:
  14.  
  15. >I've heard this said with quite a bit of frequency lately, but it
  16. >isn't true.  C compilers---even ANSI ones---don't do type
  17. >checking across separately compiled files.  If I put the function
  18. >prototype
  19.  
  20. >        int f(double);
  21.  
  22. >in one file and call f(3.14), the compiler is happy.  If I
  23. >then put the function
  24.  
  25. >        int f(int, char *) {... }
  26.  
  27. >in another file, the compiler won't complain about that either.
  28. >And I don't know of any C linkers that will complain.  If the
  29. >programmer is lucky, the program will dump core; if not, who knows
  30. >what may happen?
  31.  
  32. >It is true that if you use a certain amount of discipline and make
  33. >sure that the same prototype appears in both places---by putting it in
  34. >an include file---the compiler will detect the error.  The problem is,
  35. >there isn't any enforcement of this policy.
  36.  
  37. Ahhh, here's where coding standards come into play.  However, if you
  38. declare the functions as static then you shouldn't have a problem.
  39.  
  40. We could start a thread about coding standards, that'll get the flame throwers
  41. going. :-)
  42.  
  43.  
  44.                                                                o
  45. Sam Blackburn                                                    \
  46. Internet:   sammy@sed.csc.com                                  \O/
  47. Compuserve: 76300,326                     ||====================|====||
  48. GEnie:      SAMMY                         ||-+-+-+-+-+-+-+-+-+-/\+-+-||
  49.                                           ||===================\=\===||
  50.                                           ||                         ||
  51.                                           || Kill or be killed.      ||
  52.