I have seen this before as a reserved word, mainly in bnet bots...
example
u_long u_flags
What is u_long exactly defining the variable u_flags as?
Quote from: MoNksBaNe_Agahnim on March 26, 2004, 01:35 PM
I have seen this before as a reserved word, mainly in bnet bots...
example
u_long u_flags
What is u_long exactly defining the variable u_flags as?
probably
typedef unsigned long u_long;
I would assume it's unsigned long.
what exactly does unsigned/signed mean?
Quote from: MoNksBaNe_Agahnim on March 27, 2004, 12:22 PM
what exactly does unsigned/signed mean?
An unsigned 32-bit integer uses 32 bits to represent the amount. It can take any integer value from 0 to 4294967295.
A signed 32-bit integer uses 31 bits to represent the amount and 1 bit to represent the sign. It can take any integer value from -2147483648 to 2147483647.
Example; 3-bit integer:
The left-most bit is the sign in a signed integer, so all values where that bit is 1 are negative.
binary unsigned signed
000 0 0
001 1 1
010 2 2
011 3 3
100 4 -4
101 5 -3
110 6 -2
111 7 -1
Signed integers are represented by two's complement. That is the inversion of the bits + 1.
For example
unsigned int a = 96;
printf("%d %d\n", a, ~a + 1);
Outputs: 96 -96
what does the '~' do?
~ is bitwise NOT - it complements each bit in the parameter. (0 becomes 1, 1 becomes 0.)