Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 exptools 1/6/84; site iham1.UUCP Path: utzoo!watmath!clyde!floyd!harpo!ihnp4!iham1!fcy From: fcy@iham1.UUCP (Fred Yankowski) Newsgroups: net.lang.c,net.unix Subject: Lint question: returning enum values in function arguments Message-ID: <118@iham1.UUCP> Date: Fri, 6-Apr-84 10:27:50 EST Article-I.D.: iham1.118 Posted: Fri Apr 6 10:27:50 1984 Date-Received: Sat, 7-Apr-84 04:45:06 EST Organization: AT&T Bell Labs, Naperville, IL Lines: 44 Can anyone help me with the following `lint' problem? The C code in question follows: > 1 #include > 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" ?)