Gases in divelist
Dirk Hohndel
dirk at hohndel.org
Mon Mar 18 08:07:08 PDT 2013
"Robert C. Helling" <helling at lmu.de> writes:
>
> Gas with index 0 is assumed to be the first gas only if there is no
> gaschage event in the first 30 seconds of the dive.
Thanks, that makes sense.
I'll make one small modification:
> @@ -490,6 +493,11 @@ static void get_dive_gas(struct dive *dive, int *o2_p, int *he_p, int *o2low_p)
> }
> dc = dc->next;
> }
> +
> + /* Unless explicity set, the first gas to use has index 0 */
> + if (!first_gas_explicit && !i)
> + used = 1;
While I agree that this is correct, I find "!i" for "integer i is 0 and
not one of many other possible values" a bit unusual. Yes, we use the
same construct with "if (!strcmp(a,b))" but in general I usually
associate "!" with logical values (like "first_gas_explicit") and so
especially in this context with the logical expression right next to it
I think I'd much rather have this as
if (i == 0 && !first_gas_explicit)
Makes sense? I'll edit this in your commit.
/D
More information about the subsurface
mailing list