[Dune] Warnings about FieldVector::size

Martin Nolte nolte at mathematik.uni-freiburg.de
Tue Aug 16 16:43:04 CEST 2011


Using a static const member variable can lead to linker errors, if a reference
to this constant is passed by the compiler.
I assume that this situation would be far worse than the unnerving warning we
currently have.

To solve Markus problem, we could simply make the method variant the default
and remove the warning. The disadvantage is, of course, that the user will get
an error without knowing where it comes from. But maybe we can assume that the
average user does read the release notes before upgrading the core modules...

Since this is just transition stuff and all developers should enable the
method anyway, I don't really see the problem with that warning. The most you
can argue is that the warning should be more persuasive about enabling the
size method.

Best,

Martin

On 08/16/2011 04:06 PM, Jö Fahlke wrote:
> Am Tue, 16. Aug 2011, 15:20:16 +0200 schrieb Markus Blatt:
>> since Oliver's changes one gets a warning like "The FieldVector class
>> exports is size by the enum member 'size'..." whenever fieldvector.hh
>> is included, which is too often!
>>
>> IMHO this is rather annoying as I cannot use this warning to find
>> calls to ::size in the code. Isn't there another way of warning people
>> about the change?
> 
> Deprecating member enumberators does not appear to work in any compiler
> version I've tried.  It is however possible to deprecate member constants
> (except for clang++ which issues no warning but compiled cleanly).  See the
> documentation for DUNE_DEPRECATED [1].  Turning the enum into a member
> constant (i.e.
> 
>   static const std::size_t size = ...;
> 
> instead of
> 
>   enum { size = ... };
> 
> ) shouln't lead to any problems.
> 
> [1] http://www.dune-project.org/doc/doxygen/dune-common-html/group___common.html#gb56b68b6f47fe5b4f2bbd28d2227ca4a
> 
> Bye,
> Jö.
> 
> 
> 
> 
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune

-- 
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 mailing list