size_t, more info

Paul Harris paulharris at computer.org
Sun Nov 16 04:45:12 UTC 2008


Hi all,

I went looking for some info on when you should use size_t and when you
should use unsigned, because I didn't really know the pros and cons of each
approach...

Here is some reading:
http://www.embedded.com/columns/programmingpointers/200900195
http://www.embedded.com/columns/programmingpointers/201803576
http://www.embedded.com/columns/programmingpointers/202404371
http://www.embedded.com/showArticle.jhtml?articleID=204700432

it gives a good explanation of things

i think we should use size_t for things like size() and count_within_range()
(even if for no other reason than to follow the STL) but i'm still not clear
on what we should use for the dimension size.  to me, it doesn't seem to
make any difference, which is why i think we should just use size_t for
everything.

note that unsigned ints and size_ts are different on all platforms anyway...
see this quote:

Unfortunately, this declaration for *memcpy* comes up short on an I16LP32
processor (16-bits for int and 32-bits for long and pointers), such as the
first generation Motorola 68000. In this case, the processor can copy
objects larger than 65,536 bytes, but this *memcpy* can't because parameter
*n* can't handle values that large.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/libkdtree-devel/attachments/20081116/306395b8/attachment.htm 


More information about the libkdtree-devel mailing list