468,512 Members | 1,531 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

size_t, size_type, unsigned

Who can tell the difference in detail?

Sep 16 '06 #1
2 4044
asdf wrote:
Who can tell the difference in detail?
Your environment's headers?

--
Ian Collins.
Sep 16 '06 #2
asdf wrote:
Who can tell the difference in detail?
size_t is the type of the value returned by sizeof(). It is also a
typedef in some standard headers.

size_type is another typedef used for example in the standard
containers, like std::vector and std::string.

unsigned is a standard type that is built into the compiler. As such,
it is available immediately, without any typedefs.
On some systems, size_t, size_type, and unsigned could all be the same
type. On other systems they might be different. By always using the
proper type, your code has a bigger chance of being portable from one
system to another.

Bo Persson
Sep 16 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Christopher | last post: by
6 posts views Thread by Alex J. Dam | last post: by
10 posts views Thread by Grumble | last post: by
14 posts views Thread by tings | last post: by
7 posts views Thread by William Xuuu | last post: by
4 posts views Thread by wenjie | last post: by
3 posts views Thread by Jess | last post: by
27 posts views Thread by mike3 | last post: by
15 posts views Thread by Lambda | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.