tags:

views:

28

answers:

1

Just want to check: If you have a class that uses a method added to an existing objective-c object (i.e. NSArray) that you must define the category before the class that uses the category method. By accident I had done this the wrong way round and got the rather cryptic error ...

warning: cannot pass object of non-POD type 'void' 
through variadic function; call will abort at runtime

Moving the category before my using class removed the error, a fairly simple case of define it before you use it I guess, but I just wanted to check.

many thanks

gary

+3  A: 

As with everything in Objective-C (and plain C), things have to be declared before they are used. That means that if you want to use a function, class, category, struct or anything else in an implementation, you have to import the appropriate header file that declares it.

The order in which they are defined is irrelevant as long as the appropriate declarations are there.

Chuck
Thanks Chuck, somehow the category got out of sequence, I was a bit perplexed as the error was a little cryptic. Thanks again for the heads up.
fuzzygoat