views:

412

answers:

3
#pragma mark Internal API

I've seen this in a book called xcode_quick_tour_iphoneOS.

Does someone know about it?

+11  A: 

The #pragma directive is a special pre-processor directive that allows the C pre-processor a way to pretty much create "portable" extensions. Basically, when another pre-processor sees a pragma directive that it doesn't understand, it's supposed to ignore it.

In this case, #pragma mark is meant to aid in documentation. When you add those lines to your source file, Xcode will break up your source code in its jump-to pull-down menu that you can use to jump to specific areas in your code (like function definitions or constant definitions). If you add #pragma mark -, Xcode will add a horizontal separator to the pull-down menu as well.

Jason Coco
FYI you only need one - to make a horizontal separator.
Daniel Dickison
I originally saw it with two and never thought about it any other way, thanks :)
Jason Coco
A: 

Apple has an internal API, which is not intended to be used by application developers, so these pragmas "hide" the API from developer docs

Robert Gould
A: 

This directive is used to specify diverse options to the compiler. These options are specific for the platform and the compiler you use. Consult the manual or the reference of your compiler for more information on the possible parameters that you can define with #pragma.

If the compiler does not support a specific argument for #pragma, it is ignored - no error is generated.

See: http://www.cplusplus.com/doc/tutorial/preprocessor/ for an explanation of preprocessor directives

rjstelling