[Dune-devel] convert `enum` to `static const int`
Martin Nolte
nolte at mathematik.uni-freiburg.de
Wed Sep 20 15:40:09 CEST 2017
Hi Ansgar,
this warning exists for a long time.
While I agree that switching to a 'static constexpr int' (or 'static constexpr
unsigned int') would improve the situation, this might case a bit log of
warnings in code currently compiling fine. The problem is that comparing the
enum value to neither a signed int nor and unsigned int will cause a warning.
So, either choice might lead to a lot of warnings in user code.
Best,
Martin
On 09/20/2017 01:58 PM, Ansgar Burchardt wrote:
> Hi,
>
> it looks like GCC has new warnings:
>
> ../dune/grid/test/checkintersectionit.hh:599:58: warning:
> comparison between ‘enum Dune::Grid<[...]>::<unnamed>’
> and ‘enum Dune::Grid<[...]>::<unnamed>’ [-Wenum-compare]
>
> for the expression
>
> GridType::dimension == GridType::dimensionworld
>
> Is there any downside to changing every constant that is currently a
> `enum` to a `static const int`? (Minus deciding on the signedness, but
> that is unrelated to the `enum` -> `static const` conversion.)
>
> Ansgar
>
>
>
> _______________________________________________
> Dune-devel mailing list
> Dune-devel at lists.dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-devel
>
--
Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>
Universität Freiburg phone: +49-761-203-5630
Abteilung für angewandte Mathematik fax: +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany
More information about the Dune-devel
mailing list