← Back to team overview

yade-dev team mailing list archive

Re: Could you please fix warnings in Flow and ConcretePM ?

 

It is unsafe to not initialize. Better zero or anything else than nothing,
since nothing makes the behavior undefined, hence very difficult to debug.
Jan will tell us what a proper default could be hopefully.
Bruno

On 7 May 2015 at 19:03, Janek Kozicki <janek_listy@xxxxx> wrote:

> Thanks Anton for fixing what you could. I notice that to remove the only
> two last warnings:
>
> In file included from
> /home/salomea/yade/trunk/pkg/dem/PeriIsoCompressor.cpp:4:0:
> /home/salomea/yade/trunk/pkg/dem/PeriIsoCompressor.hpp: In constructor
> ‘Peri3dController::Peri3dController()’:
> /home/salomea/yade/trunk/pkg/dem/PeriIsoCompressor.hpp:118:1: warning:
> overflow in implicit constant conversion [-Woverflow]
> /home/salomea/yade/trunk/pkg/dem/PeriIsoCompressor.hpp:118:1:
> warning: overflow in implicit constant conversion [-Woverflow]
>
> we need a following diff:
>
> diff --git a/pkg/dem/PeriIsoCompressor.hpp b/pkg/dem/PeriIsoCompressor.hpp
> index 94f141f..299d63a 100644
> --- a/pkg/dem/PeriIsoCompressor.hpp
> +++ b/pkg/dem/PeriIsoCompressor.hpp
> @@ -109,8 +109,8 @@ class Peri3dController: public BoundaryController{
>
> ((Vector6i,ps,Vector6i::Zero(),Attr::readonly,"Peri3dController internal
> variable"))
>
> ((Vector6i,pathSizes,Vector6i::Zero(),Attr::readonly,"Peri3dController
> internal variable"))
>
> ((Vector6i,pathsCounter,Vector6i::Zero(),Attr::readonly,"Peri3dController
> internal variable"))
> -               ((int,lenPe,NaN,Attr::readonly,"Peri3dController internal
> variable"))
> -               ((int,lenPs,NaN,Attr::readonly,"Peri3dController internal
> variable"))
> +               ((int,lenPe,,Attr::readonly,"Peri3dController internal
> variable"))
> +               ((int,lenPs,,Attr::readonly,"Peri3dController internal
> variable"))
>                 ,
>                 /*ctor*/
>
>
> If you think it's acceptable, then please apply it. `git blame
> PeriIsoCompressor.hpp`
> says we should ask Jan Stránský about this. Maybe instead of NaN put some
> number?
> Or find a legal way to initialize to Nan?
>
> best regards
> Janek
>
>
> Bruno Chareyre said:     (by the date of Sun, 3 May 2015 14:48:51 +0200)
>
> > Good idea Janek. Thanks.
> > Bruno
> >
> > On 2 May 2015 at 13:00, Janek Kozicki <janek_listy@xxxxx> wrote:
> >
> > > Anton Gladky said:     (by the date of Sat, 2 May 2015 08:13:46 +0200)
> > >
> > > > I recently raised the level of warnings, so not all of them are
> > > > now fixed. Will try to fix it within the next several days.
> > >
> > > Thanks, maybe afterwards we could raise the level of warnings even
> more?
> > > One very useful candidate is `-Wshadow`, because I also lost some
> > > time trying to find a bug, which was caused by shadowing a variable
> > > by mistake.
> > >
> > > But I see some warnings from eigen due to -Wshadow, I suppose we would
> > > need to fix those warnings there also.
> > >
> > > --
> > > Janek Kozicki                               http://janek.kozicki.pl/
> |
> > >
> > > _______________________________________________
> > > Mailing list: https://launchpad.net/~yade-dev
> > > Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> > > Unsubscribe : https://launchpad.net/~yade-dev
> > > More help   : https://help.launchpad.net/ListHelp
> > >
> > >
>
>
> --
> Janek Kozicki                               http://janek.kozicki.pl/  |
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev
> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References