discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to enable "shorthand" access element in NSArray


From: Rael Bauer
Subject: How to enable "shorthand" access element in NSArray
Date: Sun, 28 Dec 2014 12:40:55 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1

Hi,

I am using GNUStep on Windows with the clang compiler.

From what I have read, I should be able to access NSArray elements with following ("universal"...) notation

myArray[index]

instead of the expanded:  [myArray objectAtIndex:1]

However, when I try the shorthand, I receive an error message from the compiler:

e.g.

    NSArray * myArray = @[@"A", @"B", @"C"];
    NSLog(myArray[1]);

error:
 passing 'NSArray' to parameter of incompatible type 'id'

Is there something special I need to do to enable this notation? (compile flag?) (Is it a problem on Windows?)

Thanks
Rael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]