[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Krazy: prefix vs. postfix ++ and -- operators
From: Rafał Miłecki <zajec5 () gmail ! com>
Date: 2011-01-11 15:26:48
Message-ID: AANLkTingNE2DdC3dKta3sD7sZVS=-8dqevcnbPca7Xr2 () mail ! gmail ! com
[Download RAW message or body]
W dniu 11 stycznia 2011 16:25 użytkownik Rafał Miłecki
<zajec5@gmail.com> napisał:
> 2011/1/11 Christoph Feck <christoph@maxiom.de>:
>> Krazy says:
>>
>> "You should use ++ and -- as prefix whenever possible as these are more
>> efficient than postfix operators. Prefix increments first and then uses the
>> variable, postfix uses the actual; the variable is incremented as well.
>> Because of this, the prefix operators are inherently more efficient."
>>
>> Considering that today's CPUs have multiple pipelines, using a value directly
>> seems faster to me than waiting for it to be incremented or decremented.
>>
>> Is this krazy warning still correct?
>
> Doesn't compiler optimize than anyway, when possible (like inside
> for)? I was told that when I tried using post incr. in kernel.
It should be "when I tried using pre incr. in kernel."
--
Rafał
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic