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?

1 Answer 1

3

Because [proc arguments]; already returns an NSArray *. Writing NSArray *myArray = [NSArray arrayWithArray: [proc arguments]]; is just redundant.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.