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