2010-08-04

Causing a compiler error -- on purpose! (in REALbasic)

If you have some broken code you want to get back to soon, you can cause a compiler error to happen as a reminder.


Add this simple line:

#error

The line above is good for a quick problem you expect to resolve ASAP, but you're afraid you might get distracted.


If the problem is going to be around for a while, you may want a message to appear as part of the compiling process. To do so, type :


#pragma error "not yet implemented (or any message you want here)"

Likewise you can cause compiler warnings. Your app will compile, but your message will appear in the list of warning messages.


#pragma warning "your message goes here"

REAL Studio 2010 has some other pragma tricks too. Several involve shutting off safety features at runtime to gain more speed.

No comments:

Post a Comment