On Mon, Sep 14, 2015 at 05:42:40PM +0200, Robert Helling wrote: > > On 14 Sep 2015, at 16:42, Dirk Hohndel <[email protected]> wrote: > > Dirk, > > > Either way - the code below has me a bit unhappy as we start the loop with > > sample pointing at the very first sample. > > > > So simply accessing sample[-1]? Probably not a good solution. > > > > Which begs the question, do we need this transition for the first step > > (which starts at the surface)? > > it’s not that I had not worried about this problem. In fact, I did some > testing and it seems the case i=0 that would access sample[-1] is dangerous. > But in fact, that is always the surface sample of 0 duration. So it does not > really do anything and I concluded this is save. But if you want, I can > protect this with a if(i) in front. Or at least add a comment or a remark in > the commit message. > > What do you think?
Accessing sample[-1] is not the right thing to do. So even if it may not matter because of the way the calculation works out, we should not do that. So I'd prefer if there was a conditional statement that prevented us from accessing sample[-1]. /D _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
