Saturday, February 25, 2012

Xcode warning: no previous prototype for function ...

This warning appears when you define a C-style function like this:

In .h:
void foo();

In .m:
void foo()
{
}

However, according to C standard, you should define the function with the void keyword if there is no parameters in your function:

In .h:
void foo(void);

In .m:
void foo(void)
{
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.