32bits vs 64bits; and do they make changes to programming? size of types?

in books, they define 8bits a byte, 4bytes a word, is this the same in 32its system and 64bits system?

short, int, long, char, w_char, boolean, float, double, long double

what will be the size to hold it in 32bits system and 64bits system?

does CPU have address of memory for every bit in the memory? or CPU only have address of every byte? (I guess not, or else, how can bitset works effeciently?)

Many questions about CPU and how it process datas, and addresses? what is the difference between 32bits and 64bits?

Where is the address information stored? in the memory? or in the CPU?
heres a good link for 32/64 bit differences.
http://www.viva64.com/en/a/0004/

your type sizes are in a table about half way down.
and for an explanation of ILP32, LP64 ...
http://www.unix.org/version2/whatsnew/lp64_wp.html
I always use the type aliases in the standard library, such as:
http://en.cppreference.com/w/cpp/header/cstdint
For containers I use container::size_type or std::size_t for plain arrays, and it's important not to forget ptrdiff_t for pointer differences and offsets since the size of pointers is almost always different and thus the size of the difference is too.

With all of the above said, I never directly use the raw primitive types because you cannot easily write portable code with them. I only use them if the interface I must work with uses them.
Last edited on
Thanks all!

How can I find how many significant figures does my machine/compiler guarantee for float/double/long double types? Is there any library functions doing these?

cause I always need to compare a doubleNumber==0? I will write something like this (abs(doubleNumber)<1.0e-GUARANTEDSIGNIFICANT), so I need to know how to find the guaranteed significant number.

why is bool type consuming 1 byte to store while it can be stored in a bit?
northfly wrote:
How can I find how many significant figures does my machine/compiler guarantee for float/double/long double types? Is there any library functions doing these?
http://en.cppreference.com/w/cpp/types/numeric_limits
northfly wrote:
why is bool type consuming 1 byte to store while it can be stored in a bit?
Because the smallest unit a computer is able to process is a whole byte. You have to do math to manipulate bits. Do note, however, that std::vector has a specialization for bool to optimize memory used so that each element actually does take up one bit (it does the math for you).
Topic archived. No new replies allowed.