1 Reply Latest reply on Sep 10, 2017 10:37 AM by user_1377889

    GCC: How are the computations' constants saved after compilation?

    michael_1534646

      Hi.

       

      In my code there are various computations. Some of them use constants, defined as fractions. For example

       

      #define CONST_1     (9 / 2)

       

      void Func1(void)

      {

           var1 = var2 * CONST_1 + 30;

      }

       

      Does the compiler compute the CONST_1 fraction and use the result as multiplication constant, or the CPU executes the full computation (i.e. multiplying by 9 and dividing by 2) every time the function is called?

       

      Thanks.