Changes

Jump to: navigation, search

Using Objective-C Preprocessor Directives

2 bytes added, 20:37, 12 November 2009
Conditional Compilation
== Conditional Compilation ==
The preprocessor supports a range of statements designed for the purposes of defining areas of code that should or should not be compiled depending on a particular setting. This is of particular importance when you have a range of code statements that are to be run when you compile you your code in a debug mode.
Suppose, for example, that in debug mode you have written a number of calls to NSLog to output diagnostic information. These would be encapsulated in ''#ifdef'' / ''#endif'' statements as follows:
</pre>
Under normal conditions this ''#ifdef'' construct will prevent the NSLog line from being compiled. In order to enable debugging code , DEBUG must be defined. This can either be achieved in the code by adding the following line:
<tt>#define DEBUG</tt>

Navigation menu