RFC: Avoiding #warning (C/C++ preprocessor extension)
Olivier Goffart
ogoffart at kde.org
Sun Oct 30 23:16:32 GMT 2005
Le Dimanche 30 Octobre 2005 21:25, Jarosław Staniek a écrit :
> 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.
All of this is correct.
Anyway, #warning are just temporary code, and they should be removed before
the release.
A good code compiles without warnings at all.
We should not simply remove the #warning line, but also fix the code.
> 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.
> http://www.englishbreakfastnetwork.org/apidocs/apidox-kde-4.0/kdelibs-apido
>cs/kdecore/html/todo.html 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.
This is a bit different: @todo are placed in header, and not directly in the
code they show.
also #warning are generally used for more important things, while @todo may be
long terms.
There is also a flag to make all warnings act like fatal error, to force to
fix them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20051031/3510dbb4/attachment.sig>
More information about the kde-core-devel
mailing list