ANSI C prototypes
Doug Gwyn
gwyn at smoke.brl.mil
Thu Nov 29 05:09:09 AEST 1990
In article <126872 at linus.mitre.org> jrv at sdimax2.mitre.org (VanZandt) writes:
>Is there a convenient way to write such functions without using a cast for
>every reference to a or b? Copying their values into local pointers of the
>appropriate type seems a kludge. I suppose I could avoid #including stdlib.h,
>and declare the arguments to be whatever type I liked.
If you don't declare the argument types properly, your code will not be
strictly conforming. The only "cheat" that is allowed is to use char*
instead of void*, because the standard required these to have the same
representation. This is NOT required for other pointer types, just for
these two.
The three obvious solutions are:
explicit cast on each usage of the arguments
use a macro to encapsulate the above casting
use auto variables of the appropriate type
More information about the Comp.lang.c
mailing list