Misdeclaring "main" (was: Re: system 5 vrs. bsd4.3 question)
Doug Gwyn
gwyn at smoke.BRL.MIL
Sun Jul 23 20:21:41 AEST 1989
In article <220 at tnl.UUCP> gwollman at tnl.UUCP (Garrett A. Wollman) writes:
-Actually, the whole business of prototyping saves me a considerable
-amount of debugging time. This allows me to catch errors such as
-passing a char to a function which takes an int, when the char was
-supposed to be unsigned. (Don't think this is a problem? Try writing
-to a file, using fputc('\xff',fp). The '\xff' will be sign-extended to
--1.)
I don't understand your example: '\xff' is an int, fputc() takes an int.
How is the use of prototypes going to help here? Indeed, why is your
compiler compiling '\xff' as -1?
More information about the Comp.lang.c
mailing list