Re: Promoting unsigned long int to long int
- From: pete <pfiland@xxxxxxxxxxxxxx>
- Date: Mon, 30 Jun 2008 14:16:53 -0400
pereges wrote:
btw, i see a lot of people saying that size_t must be used over
unsigned long. The question is are there any fix guidelines as to when
i should and when i shouldn't use size_t. It seems to me that size_t
is most commonly used in three situations :
1. Size of array or any object.
2. Array indices.
3. Count of something.
Although I don't see why using unsigned long for any of the above
could be wrong. It may not be a necessity to use size_t
size_t is for counting parts of an object.
That's cases 1 and 2 of your list.
In terms of efficiency, you can expect that size_t
will probably be the fastest type that is big enough
to do the job.
When I count nodes in linked list, I use long unsigned.
The number of nodes that malloc can generate,
isn't related to size_t.
--
pete
.
- References:
- Promoting unsigned long int to long int
- From: pereges
- Re: Promoting unsigned long int to long int
- From: Keith Thompson
- Re: Promoting unsigned long int to long int
- From: pereges
- Re: Promoting unsigned long int to long int
- From: Keith Thompson
- Re: Promoting unsigned long int to long int
- From: pereges
- Re: Promoting unsigned long int to long int
- From: pete
- Re: Promoting unsigned long int to long int
- From: pereges
- Promoting unsigned long int to long int
- Prev by Date: Re: Promoting unsigned long int to long int
- Next by Date: Re: OOP
- Previous by thread: Re: Promoting unsigned long int to long int
- Next by thread: Re: Promoting unsigned long int to long int
- Index(es):
Relevant Pages
|