Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#8403 closed Support Requests (fixed)

VC++ 2012 compiler warning C4127: conditional expression is constant

Reported by: Volker Schöch <vschoech@…> Owned by: Barend Gehrels
Milestone: To Be Determined Component: geometry
Version: Boost 1.52.0 Severity: Cosmetic
Keywords: VC++ 2012, warning, C4127, conditional expression is constant Cc:

Description

I'm using Microsoft Visual Studio 2012 to compile boost 1.52.0. I use compiler flag /W4. The following warnings (which we declared errors for our project) occur in geometry, regardless whether I'm compiling for x64 or x86:

\boost_1_52_0\boost\geometry\algorithms\convert.hpp(96): error C4127: conditional expression is constant if (Close) ...
\boost_1_52_0\boost\geometry\algorithms\detail\overlay\get_turns.hpp(263): error C4127: conditional expression is constant if (InterruptPolicy::enabled) ...
\boost_1_52_0\boost\geometry\algorithms\num_points.hpp(51): error C4127: conditional expression is constant if (s == open) ...

Maybe it's possible to eliminate those warnings for the next boost version?

Change History (5)

comment:1 by Volker Schöch <vschoech@…>, 10 years ago

Sorry, I mixed the code with the message. Unfortunately I cannot edit the original post, so here are the messages with the correct line breaks:

\boost_1_52_0\boost\geometry\algorithms\convert.hpp(96): error C4127: conditional expression is constant
if (Close) ...
\boost_1_52_0\boost\geometry\algorithms\detail\overlay\get_turns.hpp(263): error C4127: conditional expression is constant
if (InterruptPolicy::enabled) ...
\boost_1_52_0\boost\geometry\algorithms\num_points.hpp(51): error C4127: conditional expression is constant
if (s == open) ...

comment:2 by Barend Gehrels, 10 years ago

Severity: ProblemCosmetic
Type: BugsSupport Requests

This is not a bug. This requires considerable rewriting and adding speciliazations. Postponed.

comment:3 by Barend Gehrels, 10 years ago

Resolution: fixed
Status: newclosed

comment:4 by Barend Gehrels, 10 years ago

After doubting about this one, and looking at other Boost.Libraries, it is indeed probably the best to use #pragma's here. Many libraries do the same for the same problem.

Alternatives were rewriting (too much), or declaring local non-const variables to avoid this warning (I considered this as too much workaround for this message only, and this has a (though small) performance penalty)

So pragmas are added yesterday.

comment:5 by Volker Schöch <vschoech@…>, 8 years ago

This is related to Ticket #10666.

Note: See TracTickets for help on using tickets.