Divecomputer nickname handling..

Linus Torvalds torvalds at linux-foundation.org
Thu Sep 17 15:19:39 PDT 2015


On Thu, Sep 17, 2015 at 3:03 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
>
> Also, variables should start with a lower case letter... so 'old'.

Yeah, I started that.

That would imply the new one would be called "new". Which would make sense.

But guess what? C++ is a crap language.

So then you have to call it something idiotic like "oldNode". Which
the old code did.

Somebody else can do the crazy "Let's add Node to the name because
CamelCase is fine, but Old/New is not".

Maybe just "o/n". Which sucks too. Damn idiotic C++. "new" is a really
good name, and a really bad keyword.

> So you pass them in as reference but then copy them inside the function to
> local variables. why?

See my explanation in the original mail that you overlooked.

When I'm editing the C file, I don't want to edit the header file too,
just because it's a member function and declared somewhere else.  So
rather than mess with the prototype, I keep it the same and just make
the function do what I want it to do.

And the existing declaration for that was "& const".

> Maybe you could turn "showChanges()" into a function that returns bool. It
> shows the changes when compiled for debugging, but either way it returns
> true it things are changed... so maybe isDifferent(...)

This is not the same thing as "isDifferent" (btw, we have a
now-no-longer used function fro that, I just didn't remove it - see
"changesValues").

We're perfectly happy with changing the dive computer information if
the old data was empty. So it's not about being different, it's about
actually changing a non-empty value to a *different* non-empty value.

Yeah, it's messy. But exactly because this is *not* about "same", I
didn't want to make it about that.

The thing is, I hate C++ so much because the old _C_ implementation
had absolutely none of these issues. It really was fairly
straightforward. We just updated the node fields in place.

                 Linus


More information about the subsurface mailing list