Path: utzoo!utgpu!water!watmath!clyde!bellcore!faline!ulysses!allegra!princeton!udel!gatech!purdue!umd5!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.UUCP Newsgroups: comp.lang.c Subject: Re: functions defaulting to int Message-ID: <7111@brl-smoke.ARPA> Date: 16 Jan 88 08:59:41 GMT References: <528@gtx.com> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 24 Posted: Sat Jan 16 03:59:41 1988 In article <528@gtx.com> al@gtx.UUCP (Al Filipski) writes: >(Are declarations for library functions required by the standard? where >will the system call declarations go?) Yes, each header defines/declares the associated macros/functions. "A place for everything and everything in its place." Note, however, that in most cases a macro is permitted, so if you really want the function (for example, to obtain a pointer to it) you have to not only #undef the name but also explicitly declare the function yourself (in accordance with the standard's interface specification for the function). So your example would really not be any easier under ANSI C. >In my opinion, one of the main design flaws in C is the rule that >makes procedures int by default. From today's point of view, yes, but before the advent of "void" it was quite convenient. Of course it can't be changed now, due to the amount of correct existing code that would be invalidated. By the way, failure to properly declare malloc() is a common bug. It seems that since everyone has to cast its return result to the proper pointer type, they fail to observe that letting it default to int before the cast is simply wrong.