Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
C方言会影响gcc中的优化吗?也就是说(所有优化选项保持相同)gcc 是否会为 ANSI vs C99 vs ...生成更快/更慢/更大/更小的代码?
它可能,可能。
C89(“ANSI C”)和 C99 之间的一个区别是 C99restrict添加的关键字,该关键字专门用于改进优化。虽然您的代码可能没有显式使用它(因为您编写了 C89 代码),但像 <string.h> 这样的 C 语言头文件可以restrict在 C99 模式下使用时声明函数原型。这可能会或可能不会有影响。您只有在查看生成的代码时才会知道。
restrict