DragonFly BSD
DragonFly users List (threaded) for 2005-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Help with size_t


From: Chris Pressey <cpressey@xxxxxxxxxxxxxxx>
Date: Wed, 6 Apr 2005 11:35:06 -0700

On Wed, 6 Apr 2005 08:20:00 -0700
walt <wa1ter@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.
> 
> 



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]