Modify

Opened 5 years ago

Closed 5 years ago

Last modified 3 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?

Attachments (0)

Change History (5)

comment:1 Changed 5 years ago by Volker Schöch <vschoech@…>

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 Changed 5 years ago by Barend Gehrels

Severity: ProblemCosmetic
Type: BugsSupport Requests

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

comment:3 Changed 5 years ago by Barend Gehrels

Resolution: fixed
Status: newclosed

comment:4 Changed 5 years ago by Barend Gehrels

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 Changed 3 years ago by Volker Schöch <vschoech@…>

This is related to Ticket #10666.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Barend Gehrels.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.