[
Lists Home |
Date Index |
Thread Index
]
Rick Marshall wrote:
> 010? 8 fingers, sorry about your loss
Heheh :-)
[to those who don't get it, some textual representations of numbers
treat a leading zero to mean that it's in octal, and a prefix of 0x to
mean it's in hex, etc]
> interpretation of leading zeroes is problematic
Why is it problematic? It's all about context.
Found written on a random piece of paper in the street, the string "010"
has no meaning. As such, one cannot state that it's equivelant to 10, 8,
or 2 (binary), or a linefeed character, or anything.
But found in a decimal dump of the numeric values of bytes being
transmitted along a TCP stream that happens to be connecting a telnet
client to a telnet daemon, we know it means the number 'ten' with
respect to the numerical interpretation of that byte stream, and since
we know that above that representation is being layered ASCII - we know
that it also means a linefeed.
An application that doesn't know the special context wouldn't dream of
trying to interpret 010 as anything other than three characters, unless
it was broken and buggy.
> as is 32 bit integers as we move to a 64 bit world
Yes. Luckily, the ASN.1 folks thought of *that* one right at the
beginning; neither the ASN.1 abstract data model nor any of the binary
representations of abstract values have any fixed maximum size to
integers or anything like that. Two's complement fixed width bit strings
are only *one* binary encoding of integers... there are variable length
ones, too, and those who don't want to have arbitrary constraints use
them if they know what's good for them :-)
> and just for the record 10 is not a number. it's two symbols that we in
> the west with an arabic number system commonly interpret as the number
> 10 in the absence of any other information. however it could be an
> invoice number in which case it's meaningless to use any sort of binary
> coding, or a zip/post code, etc
Yep, that's my point - read the email :-) I was careful to write "10" as
the representation in text, and "ten" as the actual number, to make it
clear what I was referring to.
> i like text encodings and will keep defending them. you can just do so
> much more with them.
Prove it!
>
> rick
>
ABS
|