Sample Header Ad - 728x90

WORD_BIT vs LONG_BIT

0 votes
2 answers
253 views
What is the difference between WORD_BIT and LONG_BIT? And which one should I use to find out the word size of my system? Both return different results
➜  ~ getconf LONG_BIT
64
➜  ~ getconf WORD_BIT
32
➜  ~
I also read in some other post that a reliable way to find out word size can be to print the size of void. This gives me 8 bytes.
printf("%d\n", (int)sizeof(void*));
Will this always be equal to the result returned by getconf LONG_BIT? Sorry, sneaking one more question here - word size is related to the CPU architecture. Will OS also work on the same word size that CPU architecture has defined?
Asked by 0Nicholas (103 rep)
Mar 5, 2024, 04:48 PM
Last activity: Mar 6, 2024, 05:15 PM