On Mon, Nov 03, 2014 at 01:48:11PM +0100, Robert Helling wrote:
> Just as a general rule: “1” is never a good name for anything except the
> smalls non-negative integer.
Oh I love that... I may have to quote you at some point.
> In particular it is not a good name for a dillutant cylinder. A good
> name would be
>
> int dillutant = 1;
>
> or a label that has values in
>
> enum cylinder_role = {oc, o2, dillutant, bailout};
>
> or something like that.
Yeah, I think this should be something that is learned from the cylinder
data structure directly. Think about it. One of the cylinders is likely O₂
or something similar, one is air or some trimix gas. It's pretty obvious
which one is your oxygen cylinder, which one is your dillutant, right?
So please, do not hard code it. Create two helper functions that figure
out which one is which and then use two variables with appropriate names
to hold the result.
/D
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface