|
-
August 11th, 2008, 10:18 PM
#1
size_t
In a C++ book, it says the size_t "is guaranteed to be large enough to hold the size of an object in memory". Does that mean that the maximum size of size_t changes when u make large objects (like a bitset with a billion bits) or is its maximum size simply not defined and can be used to store any number?
Thanks
-
August 11th, 2008, 10:34 PM
#2
Re: size_t
It means that the size of size_t is implementation and platform dependent, but it nonetheless "is guaranteed to be large enough to hold the size of an object in memory", according to that book. As far as I can tell, the C and C++ standards only state that size_t is the type of the result of the sizeof operator and is guaranteed to be an unsigned integer type. I think that what that book states about such a guarantee merely follows from the relationship between sizeof and size_t.
-
August 11th, 2008, 10:59 PM
#3
Re: size_t
Practically speaking, it'll probably be true that sizeof(size_t) == sizeof(void*). Which means 32 bits on 32-bit systems, 64 bits on 64-bit systems.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|