** By prefixing with the ‘#’, before the code is actually compiled, the statement is evaluated by a preprocessor, and anything that doesn’t match the condition is completely eliminated from the compilation. If you were to have say:
#if TargetWindows then
'Implement a Windows System API Declare
#elseif TargetMacOS then
'Implement a Mac System API Declare
#elseif TargetLinux
'Implement a Linux System API Declare
#endif
and were to leave off the ‘#’, the compiler would prompt an error when it attempted to compile for the target platforms, which ever aren’t the ‘current development machine.’
Directives prefixed with a ‘#’ are only seen by the Xojo ‘Pre-compiler,’ and action is taken before it is passed to the actual compiler. Say for instance the above pseudocode was compiled for Windows… out of all the code above, the compiler would only see:
'Implement a Windows System API Declare.
If compiling for Mac, the compiler would only see
'Implement a Mac System API Declare
and so on.
When running code in the Xojo IDE, and you have breaks turned on for exceptions… say there’s a function that the code always breaks at (maybe a timer), and you really don’t need the code to ever break there, because you know there are no exceptions…
You can add:
#pragma BreakOnExceptions False
to your code, and anything below that code, will not be stopped at.
You can also add #pragma BreakOnExceptions True immediately after a line that you know you don’t ever need to break at; that way, you can debug any other possible bugs which might exist within a particular method, apart from where the ‘unnecessary’ break, that we suppressed, occurs.
You can also use pragmas directives to optimize your code a great deal, especially when dealing with processor intensive functions, any all sorts of cases (nilobject checking, bounds checking, etc.)
Learn all about them here: http://developer.xojo.com/pragma-directives