Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!ames!amdcad!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.lang.c Subject: Re: weird c code/ c test Message-ID: <25693@sun.uucp> Date: Fri, 14-Aug-87 18:46:58 EDT Article-I.D.: sun.25693 Posted: Fri Aug 14 18:46:58 1987 Date-Received: Sun, 16-Aug-87 07:09:23 EDT References: <1089@gilsys.UUCP> <175400004@uxc.cso.uiuc.edu> Sender: news@sun.uucp Lines: 26 > printf predates stdio. true, the semantics have changed a bit since > the advent of stdio (previously, we didn't need sprintf and fprintf; > printf did it all!), and a discussion of stdio would be incomplete > without covering printf, but including stdio.h solely for printf is > a bit paranoid. next, you'll want me to #include when i use > ctime(). Why, yes, as a matter of fact, I do. One hopes that with the advent of ANSI C, system include files will include full prototype declarations of the functions in the package to which that include file belongs. (Unfortunately, in general there isn't a simple match between packages and include files, but in some cases there is.) Function prototypes (assuming the compiler does the Right Thing with conversions such as conversions between pointer and integral types and between different pointer types, namely printing a warning or error) can cause some errors that now are mechanically caught only by running "lint" to be caught when compiling. This is a Good Thing. Even *without* full prototypes, including when you use "ctime" will at least fetch the declaration of "ctime", so if you forget to declare it as returning "char *" your code will still be correct (and work on machines where pointers and "int"s are not the same size). Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com