Yes, what makes binary<->hex conversion difficult? It is about the most
natural conversion one can do. Each nibble is a hex character --
simple. No need to break out a calculator or abacus for God's sake.
Anyway, macros or enumerated types will obviously be nicer to read than
hex, octal, or (God forbid) decimal flags -- as long as they are properly
named. As for using a number's binary representation in C, I've always
thought it would be handy -- however, all I really 'need' are decimal
and hex in order for me to write a kick ass program.
Regards,
Andrew Bell
-----------------------------------------------
UVic Engineering '3B'
[EMAIL PROTECTED]
-----------------------------------------------
On Sun, 30 Aug 1998, Glynn Clements wrote:
>
> James wrote:
>
> > -> How do you use binary numbers in C? i'm sure i once knew...
> > ->
> > -> i know you prefix 0x to numbers for Hex, 0 for octal, what's binary...
> > -
> > -ANSI C doesn't provide any way to specify numbers in binary.
> >
> > ahh... oops! i know where i saw it, x86 assembly : mov al, 01010101b
> > oh well, looks like i'll have to keep my calculator handy...
>
> You need a calculator to convert binary <-> hex?
>
> C'mon; there's only 16 digits to remember. If that's too difficult,
> use octal; then there's only 8 digits to remember.
>
> --
> Glynn Clements <[EMAIL PROTECTED]>
>