Take the 2-minute tour ×

I've read that _ (underscore) is only used to tell that the variable/method/class is for the API use only and should not be used by other programmers.

What about __ (double underscore)?

In this example __block BOOL found = NO;

From the Apple Docs about Block Objects.

Also, can anyone help me understand the concept of pointer-to-pointers? **var I've read some answers about it but didn't really get it. When and how should I use it?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

Single underscore is traditionally used for private API (methods and sometimes ivars). Their main purpose is to prevent name collisions.

__block is a keyword for the new blocks API. In general, double underscore keywords are for the compiler.

For pointers to pointers the NSError is a good example: When a method wants to return a new NSError object as part of its parameters (not return value), you need a pointer to a variable of type NSError *, so that you can assign it. With a simple pointer you could only access the object, but not (re-)assign it.

share|improve this answer
Great, that really helped. Thanks! –  BeOliveira Nov 30 '10 at 13:23
add comment

Your Answer


