how to prototype a function call 
Author Message
 how to prototype a function call

I have a function call:

old_vectors[3]();    

that runs fine, but gives me a warning at compile time.
But I don't know how to prototype it.



Sat, 30 Aug 2003 02:50:19 GMT  
 how to prototype a function call

Quote:

> I have a function call:

> old_vectors[3]();    

> that runs fine, but gives me a warning at compile time.
> But I don't know how to prototype it.

What are you trying to do? This looks to me like you're trying to
return an array, and that can't be done directly. You'll have to
return a pointer or a struct containing the array.

Gergo

--
How comes it to pass, then, that we appear such cowards in reasoning,
and are so afraid to stand the test of ridicule?
                -- A. Cooper



Sat, 30 Aug 2003 03:10:38 GMT  
 how to prototype a function call

Quote:

> I have a function call:

> old_vectors[3]();    

> that runs fine, but gives me a warning at compile time.
> But I don't know how to prototype it.

Given the form of the function call, `old_vectors' is an array of
pointers to function with no parameters and returning void (or
some other return type that is ignored).  So the declaration of
`old_vectors', using a prototype in the function declarator,
would look like
        void (*old_vectors[N])(void);
where N is the number of array elements.
--
"It wouldn't be a new C standard if it didn't give a
 new meaning to the word `static'."
--Peter Seebach on C99


Sat, 30 Aug 2003 03:12:50 GMT  
 how to prototype a function call

Quote:


> > I have a function call:

> > old_vectors[3]();    

> > that runs fine, but gives me a warning at compile time.
> > But I don't know how to prototype it.

> What are you trying to do? This looks to me like you're trying to
> return an array, and that can't be done directly. [...]

Look again.  He said it's a function call, not a declaration.
--
"I should killfile you where you stand, worthless human." --Kaz


Sat, 30 Aug 2003 03:13:21 GMT  
 how to prototype a function call

Quote:

>I have a function call:

>old_vectors[3]();

>that runs fine, but gives me a warning at compile time.
>But I don't know how to prototype it.

It depence the function you are calling. If it has no parameters, use (void)
in the array of pointers to function declaration.

int main (void)
{
   int (*old_vectors[4])(void) = {0}; /* To NULL by-default */

   return 0;

Quote:
}

--
-hs-    "spaces, not tabs"
CLC-FAQ: http://www.eskimo.com/~scs/C-faq/top.html
ISO-C Library: http://www.dinkum.com/htm_cl
FAQ de FCLC : http://www.isty-info.uvsq.fr/~rumeau/fclc


Sat, 30 Aug 2003 04:26:52 GMT  
 how to prototype a function call

Quote:
> `old_vectors', using a prototype in the function declarator,
> would look like
>    void (*old_vectors[N])(void);

Thanks, I was apparently missing the 2nd void.  


Sat, 30 Aug 2003 06:30:55 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. call to function prototypes

2. Warning Call to Function w/no Prototype in

3. Function prototype that RUNDLL32 calls?

4. Call to function with no prototype

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

6. prototype (?) of function passed to function

7. Function prototypes for pointers to functions.

8. HELP: function prototype with pointer to function as parameter

9. Condition breakpoints and function calls and function calls in Immediate window

10. How can i make a C call prototype to a DLL

11. Call a function in a function with name of a function as parameter

12. help:prototype inconsistent with implementation of function

 

 
Powered by phpBB® Forum Software