Re: numbers written in ascii... looking for all common (and some uncommon) forms....

From: Bx.C (invalid-email-address_at_invalid.shiragajin)
Date: 02/25/04


Date: Tue, 24 Feb 2004 20:24:38 -0600


(big snips)

> Allowing 8 and 9 into an octal constants, though, is asking for
> confusion, isn't it? Seems about as "sensible" as Intel's infamous
> "real-mode addressing", allowing something like this to have a
> non-normalised form where more than one constant can actually be
> different but numerically the same: 018 and 020, both being 16
> decimal...

ack!! is 019 = 021? or is both 018 and 019 = 020 ?

well.. (on a side note) ...we all know that halloween IS christmas
OCTal/OCTober 31 = DECimal/DECember 25... i still find that coincidence very
strange...

> I confess to have never even known about this before (perhaps I did
> read it once - I have looked through this book a few times but usually
> as "reference" rather than "cover to cover" - so I might have seen it
> before but totally forgot about it five minutes later, if I did ;),
> let alone used it...until you tipped me off and I checked it up in my
> C book just now...as I say, I'm not in any way a "fan" of octal so I
> didn't miss not knowing that this existed (although, all hell would
> have broken loose - without me understanding why - if I'd used the
> "leading zero" stuff that I actually do use in ASM coding and hex
> costants in C...but, thankfully, I never do that with decimal
> constants (I think of those like "human numbers" so leading zeroes
> just don't seem right ;) or I'd have landed myself in trouble with C
> syntax unintentionally and it would have taken them all to be octal!
> E.g. I like to write "mov ah, 4Ch" or "mov ax, 0013h" or "move ax,
> 00001234h" _with_ the leading zeroes so that the intended size of the
> constant is clear as crystal from reading the source...it's also just
> great for aligning your source code too; If you have a whole bunch of
> dword-sized data in an array then I like to align it all into neat
> "columns" and "rows" for reading...it's just a whole lot easier on the
> eyes and tidy than comma and digits thrown arbitrarily into a big mess
> of numbers somewhere ;)...
>
> Beth :)
>

i do much the same... except i throw in an extra leading zero...

4Ch = 04Ch
0013h = 00013h
00001234h = 000001234h

reason being, is that if it begins w/ A-F, you have to put a leading zero
anyway (or some other non-alpha) character, or the assembler will decide
that it's an identifier.... so to line up everything, i always have a
4-character text string for bytes (0xxh), 6 character text string for words
(0xxxxh), and 10 character text string for dwords(0xxxxxxxxh)...

now if it's not being placed into an assembly language file... but rather
it's a hex value that's being displayed to the screen (usually in such
instances, hex is implied anyway) then i'll just drop my usual leading 0 and
the trailing h



Relevant Pages

  • Re: Searching by Unicode codes
    ... "Suzanne S. Barnhill" wrote: ... Well, I've tried hex and decimal, and it didn't change anything. ... search string ^U0xnnnn, for example - no luck there, and similarly no luck ... maybe the u) to indicate some kind of special character, ...
    (microsoft.public.word.application.errors)
  • Re: Non-ascii characters in VS.NET service
    ... method that takes a string parameter. ... How is it turning the character into hex? ... What do you mean by "an XML header"? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: awk cgi for uploaded file
    ... # sequence here to avoid problems with the '&' character itself. ... String = UnEscape ... # character for the original escape sequence. ... # Hex is a string in the form \xnn where n is in the set 0-9a-f. ...
    (comp.lang.awk)
  • Re: octal and hex
    ... those are two different ways to define the same string. ... Well, yeah, bot REs will match _any_ single ASCII character. ... match a hex character but not an octal? ... I know how to denote a character in octal or hex notation. ...
    (comp.lang.perl.misc)
  • length of a string?
    ... Is there a quick way in assembly language of finding the first null character ... of a string? ... doing some fancy xor operation with one of the mm# registers? ...
    (microsoft.public.vc.language)