3 Jun 2012 08:38
Is it helpful for a compiler to optimize?
Krzysztof <kj <at> limes.com.pl>
2012-06-03 06:38:00 GMT
2012-06-03 06:38:00 GMT
Let's have a below code:
struct st
{
int iv;
/*...*/
};
void afun(struct st *stp)
{
stp->iv++;
printf("%d\n",stp->iv);
}
Is it helpful for a compiler to do better optimization if I write the
function as this?
void afun(struct st *stp)
{
int liv=stp->iv++;
printf("%d\n",liv);
}
In other words, is it better from optimization point of view to do
assignments structure members values to local variables then do what you
need to and then assign them back to member variables?
--
--
Regards
(Continue reading)
RSS Feed