Tuesday, October 19, 2010

_MSC_VER Values

VC6 - 1200
VC7 - 1300
VC7.1 - 1310
VC8 - 1400
VC9 - 1500

WINVER and _WIN32_WINNT Values

NT – 0X0400
2000 - 0x0500
XP - 0X0501
Server 2003 - 0X0502
Vista - 0X0600
Windows 7 - 0X0601

Saturday, October 16, 2010

Two ways to proof of 0.999… = 1

Long Division

1/9 = 0.111...
9 x (1/9) = 9 x 0.111...
1 = 0.999...

Digit Manipulation

X = 0.999...
10X = 9.999...
10X - X = 9.999... - 0.999...
9X = 9
X = 1

Source : http://en.wikipedia.org/wiki/0.999...#Digit_manipulation

Wednesday, October 13, 2010

Hex/int conversion in C

int –> Hex

int i = 10;
void* h =  (void*)i;

Hex –> int

void* h = 0xa;
int i = (int)((const char*)h - (const char*)0);