Help with size_t

walt wa1ter at myrealbox.com
Wed Apr 6 08:20:00 PDT 2005


To pick a random instance, in libkinfo:
size_t len = sizeof(*cputime);

By wandering through /usr/include I can find that size_t works out
to be an 'int', which makes good sense.  The number of bytes in
*cputime is going to be a small integer number, certainly not more
than 128, probably less.

So, my real question is:  why go thru the dance of using 'size_t' when
I know for sure that an 'int' is going to work perfectly?  What is the
motivation for this confusing chain of typedefs?

If I just get an example of how using 'int' instead of 'size_t' would
wind up doing the wrong thing, I would have a much better feel for this
confusing topic.

Thanks for any clues.






More information about the Users mailing list