Lint question: returning enum values in function arguments

Fred Yankowski fcy at iham1.UUCP
Sat Apr 7 01:27:50 AEST 1984


Can anyone help me with the following `lint' problem?  The C code in
question follows:

>    1	#include <stdio.h>
>    2	
>    3	enum B { FALSE, TRUE };
>    4	
>    5	main()
>    6	{
>    7		enum B	b;
>    8	
>    9		b = TRUE;
>   10		(void) printf("b = %d\n", (int) b);
>   11	
>   12		callee(&b);
>   13		(void) printf("b = %d\n", (int) b);
>   14	
>   15		callee((enum B *) &b);
>   16		(void) printf("b = %d\n", (int) b);
>   17	}
>   18	
>   19	callee(ab)
>   20		enum B	*ab;
>   21	{
>   22		*ab = FALSE;
>   23	}

In this example, a function (`callee') is being called to return an enum
value in its single parameter.  To do this in C, one must pass a *pointer*
to an enum variable.  The example compiles without complaint, but `lint'
produces the following:

>	function argument ( number ) used inconsistently
>	    callee( arg 1 )   	lint.c(21) :: lint.c(12)
>	    callee( arg 1 )   	lint.c(21) :: lint.c(15)

Why is `lint' complaining?  Is there some appropriate cast for the
function argument?  Any help with this problem will be greatly
appreciated.

	Fred Yankowski ::::: AT&T - Bell Laboratories ::::: ihnp4!iham1!fcy

	Naperville, IL 	The high-tech corridor of the Midwest :-)
			("Silicon Cornfield" ?)



More information about the Comp.lang.c mailing list