Are you targeting the non-fragile ABI? This array accessor notation is a terrible idea, so I'd recommend that you avoid it, as it (along with the property notation) destroy one of the key strengths of Objective-C: the orthogonality of syntax. In particular, with the fragile ABI, you were allowed to allocate C arrays of objects, so myArray[1] means *(&myArray + 1). It looks like that's what you're getting here, because the result of this will be an NSArray (not an NSArray*), which is incompatible with an id.
And are you sure that you're using clang? That looks very much like a GCC error... David On 28 Dec 2014, at 11:40, Rael Bauer <[email protected]> wrote: > 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 > > _______________________________________________ > Discuss-gnustep mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/discuss-gnustep -- Sent from my Apple II _______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
