开发者

non-POD type in variable argumentlist

I'm using a soap library and switching the project to the Apple LLVM 3.0 Compiler gave me a few hundred errors, anyway almost fixed them all. Exept for one.

On the line 'while (eachObject .....' gives me a compiler error 'error: second argument to 'va_arg' is of non-POD type 'id' [-Wnon-pod-varargs,3]'

I don't know the type of the passed objects. It worked in previous versions of the compiler, but this one is a little bit picky.

- (id)initWithObjects:(id)firstObj, ...{
if(self = [self init]) {

    id eachObject;

    va_list argumentList;
    if (firstObj) {
       开发者_如何学JAVA [self.items addObject: firstObj];
        va_start(argumentList, firstObj);

        while (eachObject == va_arg(argumentList, id)) {
            [self.items addObject: eachObject];
        }
        va_end(argumentList);
    }
}
return self;

}


Instead of id, try asking for the argument as a void * and casting that to id in a separate step. I'm not sure why clang is throwing a fit about this, but this should make it happy at least.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜