Do I need -pedantic flag from GCC with C11?

后端 未结 6 2116
长情又很酷
长情又很酷 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:05

    -pedantic is just a flag that turns on a whole bunch of warnings and errors and you can use it if you want, but it sounds like you really aren't using c11 or else it wouldn't give you that particular warning...

    try:

    gcc -std=c11 -Wall -pedantic program.c -o program
    

    that will make pre gcc-5 version use the C11 std as default rather than gnu89

    The default mode for C is now -std=gnu11 instead of -std=gnu89

    from gcc.gnu.org/gcc-5/changes.html

    and to go into a little more detail: the difference between c11 and gnu11 is subtle, I haven't looked into c11 as much, but in c99/gnu99 the relationship was the gnu99 was a superset of c11 and allowed some compiler extensions to the language... I highly suspect this is the same relationship with c11/gnu11

提交回复
热议问题