[geos-devel] [GEOS] #638: Recommend a static_cast around assert strings
GEOS
geos-trac at osgeo.org
Mon Aug 5 13:49:20 PDT 2013
#638: Recommend a static_cast around assert strings
------------------------+---------------------------------------------------
Reporter: goatbar | Owner: geos-devel@…
Type: defect | Status: new
Priority: major | Milestone: 3.5.0
Component: Default | Version: 3.3.8
Severity: Unassigned | Keywords:
------------------------+---------------------------------------------------
Changes (by robe):
* milestone: => 3.5.0
Old description:
> I recommend that for all asserts with strings, that they be changed to
> wrap the string in a static_cast. Not very exciting, but it makes the
> stricter compilers happier.
>
> e.g. in src/geom/util/GeometryEditor.cpp
>
> {{{
> assert(!"SHOULD NEVER GET HERE");
> }}}
>
> changes to
>
> {{{
> assert(!static_cast<bool>("SHOULD NEVER GET HERE"));
> }}}
New description:
I recommend that for all asserts with strings, that they be changed to
wrap the string in a static_cast. Not very exciting, but it makes the
stricter compilers happier.
e.g. in src/geom/util/GeometryEditor.cpp
{{{
assert(!"SHOULD NEVER GET HERE");
}}}
changes to
{{{
assert(!static_cast<bool>("SHOULD NEVER GET HERE"));
}}}
--
Comment:
Not seeing this particular error on my mingw gcc 4.8 built with cmake.
Though I do see this somewhat troubling notice
{{{
In file included from
c:/jenkins/geos/branches/3.4cmake/tests/xmltester/BufferResultMatcher.cpp:22:0:
C:/jenkins/geos/branches/3.4cmake/include/geos/geom/BinaryOp.h: In
instantiation of 'std::auto_ptr<geos::geom::Geometry>
geos::geom::BinaryOp(const geos::geom::Geometry*, const
geos::geom::Geometry*, BinOp) [with BinOp =
geos::operation::overlay::overlayOp]':
c:/jenkins/geos/branches/3.4cmake/tests/xmltester/BufferResultMatcher.cpp:80:58:
required from here
C:/jenkins/geos/branches/3.4cmake/include/geos/geom/BinaryOp.h:459:32:
warning: overflow in implicit constant conversion [-Woverflow]
long unsigned int maxScale = 1e16;
}}}
I'd just assume avoid these changes in a micro release especially since we
plan to release soon and sounds like a lot of changes would need to be
made to accommodate this. Pushing to 3.5
--
Ticket URL: <http://trac.osgeo.org/geos/ticket/638#comment:4>
GEOS <http://geos.refractions.net/>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).
More information about the geos-devel
mailing list