Compatibility of C89/C90, C99 and C11

后端 未结 4 1358
梦如初夏
梦如初夏 2021-02-14 03:15

I just read: C Wikipedia entry. As far as I know there are 3 different versions of C that are widely used: C89, C99 and C11. My question concerns the compatibility of source cod

4条回答
  •  既然无缘
    2021-02-14 03:54

    In general, newer versions of the standard are backward compatible.

    If not, you can compile different .c files to different .o files, using different standards, and link them together. That does work.

    Generally you should use the newest standard available for new code and, if it's easy, fix code that the new standard does break instead of using the hacky solution above.

    EDIT: Unless you're dealing with potentially undefined behavior.

提交回复
热议问题