Topic: When to use size_t ?


Author: abed@saturn.wustl.edu (Abed M. Hammoud)
Date: 1 Nov 1993 14:50:14 GMT
Raw View
Hello,

I was under the impression that I should use size_t to represent any
non-negative value. At the moment I have the logical operators defined
on my classes return object of type size_t instead of int.

Is there a rule that I should follow. Also loop counters I declare
to be of type size_t like:

for (size_t i = getLen(); i; i--)
   etc...

(P.S: I am using g++ 2.4.5 on sun4 machine, size_t is defined as unsigned
long int)

Thanks for any comments,
+-------------------------------------------------+-----------------------+
|Abed M. Hammoud (KB0INX)     | abed@saturn.wustl.edu |
|Washington University.      | Office:               |
|Electronic Systems & Signals Research Laboratory.| -Voice:(314) 935-7547 |
|Department of Electrical/Biomedical Engineering. | -FAX:  (314) 935-4842 |
|Campus Box 1161, One Brookings Drive.    |     |
|St. Louis, MO , 63130 USA     |                       |
+-------------------------------------------------+-----------------------+