-
Notifications
You must be signed in to change notification settings - Fork 223
Fix/warnings #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/warnings #218
Conversation
…C constant condition warning.
…constant conditions.
This fixes the ticket: https://svn.boost.org/trac/boost/ticket/10666 |
//namespace boost { namespace geometry { namespace detail { | ||
//BOOST_FORCEINLINE bool condition(bool const b) { return b; } | ||
//}}} // boost::geometry::detail | ||
//#define BOOST_GEOMETRY_CONDITION(CONDITION) boost::geometry::detail::condition(CONDITION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't these comments go away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep it in case if some other or future version of MSVC didn't work as expected or started to generate a warning in additional cases, e.g. for the workaround below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - please add a comment then, in case anyone later thinks to remove old code
@@ -123,7 +125,7 @@ struct convex_hull<Box, box_tag> | |||
boost::array<typename point_type<Box>::type, 4> range; | |||
geometry::detail::assign_box_corners_oriented<Reverse>(box, range); | |||
geometry::append(out, range); | |||
if (Close) | |||
if ( BOOST_GEOMETRY_CONDITION(Close) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the extra spacing you added - it is not according to our guidelines, and never used in this sourcefile (at least not in the original version).
Thanks for the PR. See my comments but basically I'm OK having this in our library |
Ok, thanks for the review. I addressed all of the issues. I'm merging. In case of problems I'll act accordingly. |
This PR fixes the MSVC compiler warning C4127: conditional expression is constant in all parts of the library.
For this purpose a macro BOOST_GEOMETRY_CONDITION was added. It should be used in cases when a conditional expression may be constant.
Note that the same expression may or may not be constant in various cases when template specialization is involved.