I was working on a feature (to be developed in c++), which wasn't yet committed to any products :-( but had a high probability to get approved. Accordingly, i was expected to work in the test environment with temporary resources like conditional compilation and other resources specific to the platform.

Naturally, there is a tendency to develop the code and have a temporary hack like

#define NEW_FEATURE_NUMBER TRUE

The code was finished, the testing was done, everything is cool. We are just waiting for the approval from management :-). However, the temporary hacks are still present in the code and as the work was completed, i was asked to move on to other projects.
From here on, as and when the feature is approved, i would be expected to complete the formalities and have the changes in the main release line. Here comes the problem, there is a high probability that i might forget to remove the temporary hacks and have the code released with these hacks, and might have to think about an excuse...

Good that i have the #error feature to help me out... causing the compiler to give an error with a custom message,

#error "Warning: Temp conditional compilation enabled"
#define NEW_FEATURE_NUMBER TRUE

Now i can't get this file compiled and consequently can't have it released too :-). Further more, it would indicate the nature of the hack to any developer working on this file. A very nice way to put things on hold when moving to a different file.

No comments: