free as a function argument and compiler warning on prototype 
Author Message
 free as a function argument and compiler warning on prototype

I have the following protoype definitions for a function defined
on a list of generic objects.  

typedef void *Generic;
LIST *fcn (Generic data, LIST *l, void (*free_data) (Generic data));

Why does the compiler give a warning to the statement:
 l = fcn (some_data, l, free);

warning: argument is incompatible with prototype: arg #3
I thought free  has the type

        void free (void *storage)



Wed, 05 Mar 1997 00:30:31 GMT  
 free as a function argument and compiler warning on prototype


Quote:

>I have the following protoype definitions for a function defined
>on a list of generic objects.  

>typedef void *Generic;
>LIST *fcn (Generic data, LIST *l, void (*free_data) (Generic data));

>Why does the compiler give a warning to the statement:
> l = fcn (some_data, l, free);

>warning: argument is incompatible with prototype: arg #3
>I thought free  has the type

>        void free (void *storage)

It does on an ANSI conformant system. Are you sure your compiler is ANSI
and that you have included the stdlib.h header?

--
-----------------------------------------


-----------------------------------------



Fri, 07 Mar 1997 02:17:01 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help with gcc warnings/function prototype

2. Warning Call to Function w/no Prototype in

3. warning C4550: expression evaluates to a function which is missing an argument list

4. Function Prototypes -- which UNIX compilers?

5. Calling a function by ptr, getting a compiler warning

6. Help, DOS Borland Compiler Warning -- ANSI Peek Function

7. C4201 and C4214 warnings at Compiler Warning Level 4

8. Prototypes (variable # of arguments)

9. No warnings for prototype erros

10. Function returning a function-pointer - how to prototype ?

11. Passing function pointer with arguments as an argument?

12. defining function whose type same as its arguments and used as another's argument

 

 
Powered by phpBB® Forum Software