Optimization of variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Will the following C code :

int y;
{
   int   x1, x2;

   x1 = 3;
   x2 = 4;

   y = x1 + x2;
}

be compiled as :

int y = 7;

automatically, without creating the extra variables on the stack and performing the addition calculation?

Is this true of all code, or only with certain optimizations (e.g. -O2).

Thanks,

Marcus.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux