This is mainly geared towards students in computer science and related majors, I’m not sure if this is a best practice in the real world (there are probably all sorts of other proprietary TOOLS to manage your C++ projects for you)
So here’s the scenario. I’ve got a C++ project, and in each assignment, I have to add in a little bit more functionality. Looking forward to the future assignments (I have no idea what they are yet) I tend to write methods (or at least declare and document) for things I foresee as useful. The problem is that since the methods aren’t immediately tested, they tend to go unfinished. We have no requirements to resize an image that is loaded (yet), so if I’m in a time crunch, the only thing I do is make sure the thing compiles!
Well having a lot of unfinished methods actually starts to get messy. I realized earlier that I have a bazillion or so comments that really look cluttered and there is no specific format so Ctrl + F isn’t the most efficient way of finding an unfinished implementation.
Why not just have the compiler throw a warning if something is unfinished? You are guaranteed to find those things multiple times per day and the warnings might get so annoying you’ll be more motivated to finish and test stuff!
#warning TODO resizeImage() implementation
Well here’s the basic format. Most compilers will throw a warning for each #warning declared. The main exception is MSVC, but in that case you are really on a completely different level of programming and have all of Microsoft’s tools at your disposal. I include TODO so I can easily Ctrl+F it, and most IDEs have a todo list that basically lists each line that include TODO in a comment. Finally, I include the method name for convenience–if your IDE has a built in compiler you can probably double click the warning message to go to the method (my favorite IDE, Code::Blocks, works that way).
And finally, how not to be lazy: don’t remove the #warning until the implementation works, and you have a solid way of testing it.