[PATCH 1/5] Add function to calculate gas maximum narcotic depth

Anton Lundin glance at acc.umu.se
Sun Jul 3 13:17:13 PDT 2016


On 03 July, 2016 - Rick Walsh wrote:

> On 3 July 2016 at 04:27, Anton Lundin <glance at acc.umu.se> wrote:
> 
> > On 01 July, 2016 - Rick Walsh wrote:
> >
> > > Signed-off-by: Rick Walsh <rickmwalsh at gmail.com>
> > > ---
> > >  core/dive.h | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > >
> > > diff --git a/core/dive.h b/core/dive.h
> > > index 5988990..6910eb2 100644
> > > --- a/core/dive.h
> > > +++ b/core/dive.h
> > > @@ -481,6 +481,17 @@ static inline depth_t gas_mod(struct gasmix *mix,
> > pressure_t po2_limit, struct d
> > >       return rounded_depth;
> > >  }
> > >
> > > +/* Maximum narcotic depth rounded to multiples of roundto mm */
> > > +static inline depth_t gas_mnd(struct gasmix *mix, int end, struct dive
> > *dive, int roundto) {
> >
> > I'd prefer if both end and roundto were depth_t's instead of int.
> > Simpler to know the unit instead of needing to look at the code.
> >
> >
> > Thanks Anton,
> 
> I was in two minds as to whether to use int or depth_t for these
> functions.  In the end I went with int as there are a few other places in
> dive.h and elsewhere where int is used for depth, and I was trying to be
> least inconsistent.
> 

I noted that to when i looked at the surrounding code. I still think its
a good idea to try to use them in every case.

> I agree depth_t and the other special data types remove ambiguity, so I'll
> see if Robert or others have more comments, and either re-send the patch
> series using depth_t, or send a fixup patch.  If I get a bit of time I
> might even send a patch to use the special data types elsewhere and see
> what I break.
> 

I would love to see that we used our clearer types more. I have tried to
use them where-ever i (re)write code, and I think its about time to
start re-writing code just to start to use them. The more we use them
the easier it will get.


//Anton


-- 
Anton Lundin	+46702-161604


More information about the subsurface mailing list