This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler options on v20.2.0.LTS

Can Someone explain the opt_level=0.

What is removed  by " – Eliminates unused code" and

what is simplified by "– Simplifies expressions and statements"

Thanks.

  • Reinhold Frese said:
    What is removed  by " – Eliminates unused code" and

    Suppose the code is ...

    if (var) return 10;
    /* more code here */

    Suppose, because of optimization, the compiler determines that var is not 0.  In that case, that entire sequence changes to ...

    return 10;

    The /* more code here */ is unused, and thus eliminated.

    Reinhold Frese said:
    what is simplified by "– Simplifies expressions and statements"

    Suppose the code is ...

    var1 = var2 + 5;

    Suppose, because of optimization, the compiler determines that var2 is 10.  In that case, that statement changes to ...

    var1 = 15;

    Thanks and regards,

    -George