questions about size_t
- From: edware <erixk@xxxxxxxxxxx>
- Date: Thu, 27 Apr 2006 16:31:34 GMT
Hello,
I have some questions about the size_t type.
First, what do we know about size_t? From what I have
read I believe that it is an unsigned integer,
but not necessarily an int. Am I correct?
Does this mean that if I need to compare two variables,
one of the size_t type, should the other also be a size_t
variable? There could be problems if I compare it with an
int, if those have different sizes, right?
Most of the time when I make for loops, I use an int variable
as index, like for (int i = 0; ...)
Should I change that to size_t if I need to compare the i
variable with the return value of strlen(), for example?
I think that just adds more things to think about,
wouldn't it be easier to just use an unsigned int, instead
of the size_t variable for strlen, sizeof, etc. ?
Whats the benefit of size_t?
Is there advantage using it for your own stuff, like
struct {
size_t size;
void *stuff;
};
or
make_balloon(size_t balloonsize);
or should it only be used for the standard functions?
.
- Follow-Ups:
- Re: questions about size_t
- From: pete
- Re: questions about size_t
- From: Walter Roberson
- Re: questions about size_t
- From: void * clvrmnky()
- Re: questions about size_t
- Prev by Date: Re: How to know two lines are a pare parallel lines
- Next by Date: Re: Odd char string initialization in structs
- Previous by thread: How to know two lines are a pare parallel lines
- Next by thread: Re: questions about size_t
- Index(es):
Relevant Pages
|
|