B
Bill Davy
Victor Bazarov said:Are you saying that 040 is more difficult to read than 0x20? Just
checking...
V
O40 loks like a number, but is not.
Victor Bazarov said:Are you saying that 040 is more difficult to read than 0x20? Just
checking...
V
Only two small quibbles... it was not at all clear to me what this was
supposed to indicate. Now that I know the secret handshake, it makes
more sense. And doing it in HEX is no problem at all, at least for me.
Maybe it is the dinosaur in me.
0x0002 or 0x0008 is rather trivial and does not cause me to stop.
However, when the bitmask becomes used for multiple things, then I
would say that the following reads trivially while a pure hex based
implementation would force me to stop and start to very carefully
count bits:
const unsigned wakeupBit = 1;
const unsigned someOtherBit = 2;
...
const unsigned superBit = 13;
...
const unsigned hyperBit = 23;
const unsigned gigaBit = 24;
...
const unsigned ultraBit = 29;
"Bill Davy" wrote in message
Ox20 looks like a number, but it is not. l00 looks like a number, but it is
not. What is your point?
Jorgen Grahn said:I suspect others write 'unsigned int' because they believe verbosity
increases readability. I remember I did that very early in my career.
I have the exact opposite experience: Most noobs believe that verbosity
decreases readability, and thus proceed to write what effectively is
obfuscated C++.
Unfortunately, even some experienced professionals have this
misconception.
Why not use octal? Saves you typing an "x". After all, the creators of C
were quite happy with octal for expressing low level bit patterns.
No, I'm saying that I can look at 0x12345678 and visually determine which
bits are set in which bytes. It's much more complicated for 02215053170.
On the other hand, when I was writing PAL-D code for the pdp8, 4 digit octal
numbers worked just fine due to the 12-bit word.
On 10.01.2012 09:30, Nick Keighley wrote:
Why not use octal? Saves you typing an "x". After all, the creators of C
were quite happy with octal for expressing low level bit patterns.
I've used both in the past. Hex is more compact and fits better to 8,
16 and 32 bit quantities. But i suspect you know this.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.