Trying to understand some details about expression simplification from the compiler manual, and I have some questions for clarification:
- Not sure from the manual what level of optimization includes expression simplification? Or does it happen even if optimizations are off?
- Does expression simplification occur when typecasts are included? For example, if I use the macro SENSOR_LSB in the example below, will it do the division operation at run time or will the compiler realize that it is a constant value everywhere?
#define SENSOR_MAX_COUNTS 1000U #define SENSOR_RANGE 5.0 #define SENSOR_LSB (SENSOR_RANGE/(float)SENSOR_MAX_COUNTS)
Thank you!