65.9K
CodeProject is changing. Read more.
Home

32-Bit or 64-bit OS ??

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.62/5 (13 votes)

Sep 8, 2010

CPOL
viewsIcon

19062

In C++ you can use the size of a pointer to work out what sort of process you're running in:bool is_64_bit(){ return sizeof(void *) == 8;}This has got the advantage of being portable and you don't have to call any OS functions.You can do something similar in C - just return...

In C++ you can use the size of a pointer to work out what sort of process you're running in:
bool is_64_bit()
{
    return sizeof(void *) == 8;
}
This has got the advantage of being portable and you don't have to call any OS functions. You can do something similar in C - just return an int instead.