471,850 Members | 1,015 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,850 software developers and data experts.

size_t, size_type, unsigned

Who can tell the difference in detail?

Sep 16 '06 #1
2 4207
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
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.