All the hashtags in Objective-C

506 views Asked by At

I'm trying to learn iOS development (Objective-C) and I want to know what all the weird little "hashtags" or "pound symbols" mean. For example...

  • #import is used to import a header file, and can be used in either of the following syntaxes (first is for a class in your project and second is by imported framework)

    #import "PREFIX-SomeClass.h"

    #import <SomeFramework/SomeFramework.h>

  • #pragma, that I know, can have arguments appended to it that do IDE-specific stuff. The only function I know of is #pragma mark, and that puts a little mark in the compiler you can refer back to later. (It is worth noting that these two examples below do different things, due to the hyphen:)

    #pragma mark Refer back to this later, but don't put a horizontal divider before it.

    #pragma mark - This groups a set of functions with a horizontal divider.

Any idea what the rest of these functions are? Can somebody at least give me a reference?

1

There are 1 answers

3
phyrrus9 On BEST ANSWER

These are called preprocessor directives.

A list of them for clang (the native OSX compiler) can be found at https://gcc.gnu.org/onlinedocs/cpp/Index-of-Directives.html#Index-of-Directives