Search code examples
cgccoptimizationdialect

Does C dialect affect optimization in gcc?


Does C dialect affect optimization in gcc? That is (all optimization options being held the same) will gcc produce faster/slower/larger/smaller code for ANSI vs C99 vs ...?


Solution

  • It could, likely.

    One difference between C89 ("ANSI C") and C99 is the restrict keyword added with C99, which is specifically geared towards improving optimization. While your code may not explicitly use it (because you wrote C89 code), the C language headers like <string.h> may declare function prototypes using restrict when in C99 mode. This may or may not have an effect. You'll only know when you look at the generated code.