Device serial numbers [was: Clean up some of the dive computer nickname code]

Linus Torvalds torvalds at linux-foundation.org
Sat Jan 12 21:43:51 UTC 2013


On Sat, Jan 12, 2013 at 1:36 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
>
> Well this works, but I really would LIKE a string.

Absolutely. The serial number *has* to be a string. Serial numbers
really aren't numbers.

The "identification number" (the thing that libdivecomputer now calls
the serial number) can be a 32-bit number. That always works for
identification, even if for some dive computers it might then have to
be some hash of the "real" identification mark. But serial numbers
simply aren't numbers. They have dashes, they have letters, they have
specific formats. Even when they are "numbers" they may have very
specific limits ("6 decimal digits zero-padded" or whatever)

So despite being called "numbers", they are very much strings. They
CAN NOT be represented as a numeric entity.

              Linus




More information about the Devel mailing list