Re: Does Casting Slow a Program Down?
- From: Chris Dollin <chris.dollin@xxxxxx>
- Date: Wed, 31 Jan 2007 15:04:29 +0000
PeterOut wrote:
If I had code like this.
unsigned short usLimit=10
int a[10], i;
for (i=0; i<(int)usLimit; ++i)
{
a[i]=(int)usLimit;
}
would it run slower than this?
int a[10], i, iLimit=10;
for (i=0; i<iLimit; ++i)
{
a[i]=iLimit;
}
It might, but it would have nothing to do with the casts,
since they're both unnecessary -- `usLimit` is
converted from `unsigned short` to `int` regardless.
In any case, the Standard is silent on the issue.
--
Chris "electric hedgehog" Dollin
The "good old days" used to be much better.
.
- Follow-Ups:
- Re: Does Casting Slow a Program Down?
- From: Peter Nilsson
- Re: Does Casting Slow a Program Down?
- From: Roland Pibinger
- Re: Does Casting Slow a Program Down?
- References:
- Does Casting Slow a Program Down?
- From: PeterOut
- Does Casting Slow a Program Down?
- Prev by Date: Re: Does Casting Slow a Program Down?
- Next by Date: Re: Does Casting Slow a Program Down?
- Previous by thread: Re: Does Casting Slow a Program Down?
- Next by thread: Re: Does Casting Slow a Program Down?
- Index(es):
Relevant Pages
|