[Qgis-developer] Small patch to cleanup enum conversion in class QgsGdalProviderBase
Jürgen E. Fischer
jef at norbit.de
Fri Feb 20 12:34:48 PST 2015
Hi David,
On Fri, 20. Feb 2015 at 16:28:19 +0100, David Weiß wrote:
> Thanks for the review.
> I see your point, but I suggest this should rather be handled by a unit test,
> a linter or -Wswitch-enum for recent compilers.
> I consider switch w/o default bad practice, especially if the enum provides
> kind of a default value.
How would gcc (we usually build with -Wall) or any lint (we use cppcheck and
coverity) catch that there is a new input enum values to handle if there is a
default case?
In the current code the compiler would warn about it, while in the proposed
version it wouldn't have and new enum values that might need handling might be
introduced unnoticed. In what way would the latter generally be "better
practice"?
I also wonder how a unit test to cover this could look like.
Jürgen
--
Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50
Software Engineer D-26506 Norden http://www.norbit.de
QGIS release manager (PSC) Germany IRC: jef on FreeNode
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150220/d3e2786d/attachment.pgp>
More information about the Qgis-developer
mailing list