This is probably a C++ 101 question: I'm curious what the guidelines are for using size_t
and offset_t
, e.g. what situations they are intended for, what situations they are not intended for, etc. I haven't done a lot of portable programming, so I have typically just used something like int
or unsigned int
for array sizes, indexes, and the like. However, I gather it's preferable to use some of these more standard typedefs when possible, so I'd like to know how to do that properly.
As a follow-up question, for development on Windows using Visual Studio 2008, where should I look to find the actual typedefs? I've found size_t
defined in a number of headers within the VS installation directory, so I'm not sure which of those I should use, and I can't find offset_t
anywhere.