Modify

Ticket #8403 (closed Support Requests: fixed)

Opened 13 months ago

Last modified 13 months ago

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

Reported by: Volker Schöch <vschoech@…> Owned by: barendgehrels
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

Change History

comment:1 Changed 13 months 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 13 months ago by barendgehrels

  • Type changed from Bugs to Support Requests
  • Severity changed from Problem to Cosmetic

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

comment:3 Changed 13 months ago by barendgehrels

  • Status changed from new to closed
  • Resolution set to fixed

comment:4 Changed 13 months ago by barendgehrels

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.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.