Path: utzoo!attcan!uunet!peregrine!elroy!ames!ucsd!rutgers!bellcore!tness7!ninja!dalsqnt!rpp386!pigs!haugj From: haugj@pigs.UUCP (The Beach Bum) Newsgroups: comp.sys.ibm.pc Subject: Re: Function declarations Summary: total boguosity ... Message-ID: <398@pigs.UUCP> Date: 9 Sep 88 14:44:21 GMT References: <64@cybaswan.UUCP> <12400016@cpe> Reply-To: haugj@pigs.UUCP (The Beach Bum) Organization: The Big "D" Home for Wayward Hackers Lines: 26 In article <12400016@cpe> tif@cpe.UUCP writes: >Written 6:40 pm Sep 4, 1988 by bigtex.UUCP!james in cpe:comp.sy.ibm.pc >>It's worse than all that. ANSI C permits conflicting function >>declarations without a warning - indeed it is required that no warning >>be given. ... >>... and I can't conceive of any >>implementation where the ANSI C requirement is actually useful. > >I can. When you want to use a return value in more than one way. bad move. if the return value is actually (char *), declaring the function to return (long *) is NOT going to have the same effect as an explicit cast in all situations. various C compilers return pointers in one register and non-pointers in another. the system v/68k compiler from motorola comes to mind as one which has behavior like this. other machines have different formats for pointers to different objects. the CORRECT, PORTABLE, method is to correctly declare the return value and then cast the result. -- =-=-=-=-=-=-=-The Beach Bum at The Big "D" Home for Wayward Hackers-=-=-=-=-=-= Very Long Address: John.F.Haugh@rpp386.dallas.tx.us Very Short Address: jfh@rpp386 "ANSI C: Just say no" -- Me