Mail Archives: djgpp/1998/01/16/06:21:47
> A field declared as `int x:1;' has only one bit. As that field is in a
>signed mode, that bit is the sign bit, and if that bit is set, the value is
>treated as -1. If you want a field `int x:N;' to contain values from 0 to
>pow(2,N)-1, you must declare the field as `unsigned int x:N;'.
> If a program contains the words `unsigned' and `register' a lot, I find
it
>useful to put these lines at the top of the program file:-
>#define uns unsigned
>#define reg register
Thanks. (So logical, so wise... and yet - never occurred to me...).
Anyway, about your final remark there: isn't it better to use:
typedef unsigned int uns
rather than :
#define uns unsigned
?? This form is checked by the compiler (and not precompiled), and sounds a
better way to do the same.
---------------------------------------------
Noam Rotem
John Bryce Training Centre
Tel Aviv, Israel.
03-7535803
=============================================
1. Take upon yourself an impossible mission.
2. Accomplish the mission.
3. Go back to step 1.
It's the only sane answer to modern life.
---
14/01/98
16:14:35
- Raw text -