[PATCH] Re: Beta Testing - Dive Planner

Robert Helling helling at atdotde.de
Mon Sep 14 08:42:40 PDT 2015


On 14 Sep 2015, at 16:42, Dirk Hohndel <dirk at hohndel.org> 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?

Robert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20150914/72d48696/attachment.sig>


More information about the subsurface mailing list