Help with size_t
Chris Pressey
cpressey at catseye.mine.nu
Wed Apr 6 11:33:29 PDT 2005
On Wed, 6 Apr 2005 08:20:00 -0700
walt <wa1ter at xxxxxxxxxxxxx> wrote:
> 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?
http://en.wikipedia.org/wiki/Abstraction
-Chris
> 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