[Insight-developers] VS warning suppression in itk
Rupert Brooks
rupert.brooks at gmail.com
Tue Jul 30 17:15:35 EDT 2013
Hi everyone,
This has apparently been happening for a long time, but i only noticed it
recently. ITK suppresses a number of Visual Studio warnings in its header
files, without pushing or popping the warning state. As a result,
including an ITK header quietly suppresses a number of warnings in my own
code.
This is rather undesirable, as our coding standard decisions were to have
those warnings on, intentionally, and this slipped by completely unnoticed
for quite some time.
Among the warnings suppressed are
warning C4018: '<' : signed/unsigned mismatch
warning C4305: 'initializing' : truncation from 'double' to 'float'
warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
Most, but not all, of the suppression takes place in itkWin32Header.h.
However C4018 is suppressed in vcl_compiler.h. There are probably other
subtleties. I discovered it on 3.20, and its also true in the current
release.
I'm curious if this is a design choice, an oversight, or a downright bug.
Global warning suppression seems counter to the "ITK way".
A possible workaround is to remember to do a #pragma warning(push) and
(pop) around itk headers. If anyone has a better workaround, please let me
know.
Best,
Rupert
--------------------------------------------------------------
Rupert Brooks
rupert.brooks at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130730/55b9660b/attachment.htm>
More information about the Insight-developers
mailing list