Function prototypes specify the following information to the compiler:
The type returned by the function
The number of the arguments to the function
The type of each argument
static int xxgetinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg, void **result) { /* definition */ } static int xxopen(dev_t *devp, int flag, int otyp, cred_t *credp) { /* definition */ }
This allows the compiler to do more type checking and also to promote the types of the parameters to the type expected by the function. For example, if the compiler knows that a function takes a pointer, casting NULL to that pointer type is no longer necessary. Prototypes are provided for all Solaris 7 DDI/DKI functions, provided the driver includes the proper header file (documented in the manual page for the function).