Do I need -pedantic flag from GCC with C11?

后端 未结 6 2119
长情又很酷
长情又很酷 2021-02-09 05:42

I\'m currently running Linux Mint on my Machine with GCC-5.3 because C11 is included default.

I started learning C fo

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-09 06:10

    From the formal point of view, if you are planning to write your code in standard C you definitely need -pedantic flag (moreover, -pedantic-errors might be even better idea). However, the original implementation of -pedantic suffered from one rather questionable design decision: it included warnings related to implementation limits (which is OK), and on top of that it also turned them into errors in -pedantic-errors mode (which, in my opinion, is unacceptable).

    Warnings about implementation limits might be useful, but still it might be a good idea to keep them controllable independently, keeping -pedantic reserved for straightforward constraint violations.

    The fact that you no longer see warnings about implementation limits with -pedantic might mean that GCC 5 finally decided to take care of this matter. If so, it would be a welcome change (but more likely it is the limits that changed).

提交回复
热议问题