0

This is a little part of the code:

int main (int argc, const char * argv[]) {
    @autoreleasepool {
        NSProcessInfo *proc = [NSProcessInfo processInfo];
        NSArray *myArray = [proc arguments];
        ...

Why isn't it written like NSArray *myArray = [NSArray arrayWithArray: [proc arguments]];? Also, with ARC does that mean arrays don't need their init methods?

4

1 に答える 1

3

[proc arguments];すでに . を返しているためNSArray *です。書くNSArray *myArray = [NSArray arrayWithArray: [proc arguments]];ことはただの冗長です。

于 2012-08-07T12:07:22.493 に答える