G
Gernot Frisch
Hi,
is this code:
class XY{};
void foo(bool b)
{
XY a;
if(b)
{
XY c;
c.Dosomething();
}
}
more efficient than:
void foo(bool b)
{
XY a, c;
if(b)
{
c.Dosomething();
}
}
if (!b), or will the compiler (gcc 3.3.3+, VC7.1) recognize it and
produce the same code?
Because I'm always writing such code and am not sure if the compiler
would have been smart enough to do that itself.
is this code:
class XY{};
void foo(bool b)
{
XY a;
if(b)
{
XY c;
c.Dosomething();
}
}
more efficient than:
void foo(bool b)
{
XY a, c;
if(b)
{
c.Dosomething();
}
}
if (!b), or will the compiler (gcc 3.3.3+, VC7.1) recognize it and
produce the same code?
Because I'm always writing such code and am not sure if the compiler
would have been smart enough to do that itself.