RFC: Avoiding #warning (C/C++ preprocessor extension)
js at iidea.pl
Sun Oct 30 20:25:26 GMT 2005
Since KDE is becoming more portable, my proposal is to avoid using #warning
C/C++ preprocessor's extension. Unlike #error, #warning is not a standard -
several compilers in addition to gcc implement this. Msvc compiler does not.
- #warnings can be annoying to see during compilation if used too much.
- #warnings are not an substitute for communication and discussions about a
given TODO or uncertainty
- #ifdef __GNUC__ is required to make code portable
To find a solution I would propose to:
1. Preferred way: Using doxygen @todo tag instead of #warning. Then warnings
can be accessible:
1.1. Within Doxygen docs (Related Pages->Todo list), eg.
1.2. By just grepping for @todo. This is no different to using #warnings
because every #warning can quickly disappear from your screen during
compilation, so you still need to find it in the code.
2. If somebody couldn't _really_ live without _several_ #warnings, please
remember about adding #ifdef __GNUC__.
I know it's matter of taste, but for some people solution 2. looks dirty
compared to solution 1.
regards / pozdrawiam,
Jaroslaw Staniek / OpenOffice Polska
http://www.kexi-project.org | http://koffice.org/kexi
KDE3, KDE4 libraries for developing MS Windows applications:
More information about the kde-core-devel