Contents
What does pedantic flag do?
-pedantic : used in conjunction with -ansi , this tells the compiler to be adhere strictly to the ANSI standard, rejecting any code which is not compliant.
Should I use werror?
If your goal is to make the most portable, most standards-compliant code, then yes, I’d highly recommend always using -Werror and -pedantic-error (along with -Wall and -Wextra ), especially when starting new projects.
What is pedantic GCC?
The -pedantic option tells GCC to issue warnings in such cases; -pedantic-errors says to make them errors instead. This does not mean that all non-ISO constructs get warnings or errors. See Options to Request or Suppress Warnings, for more detail on these and related command-line options.
When to use-pedantic flag in G + + or not?
-Werror tells it to make all warnings into errors. -Wpedantic or just -pedantic tells it to: Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions, and some other programs that do not follow ISO C and ISO C++.
Do you need pedantic flag from GCC with C11?
That’s malformed code according to the standard, but GCC (5.3.0 specifically tested, but the other 5.x and 4.x versions behave the same) allows it, interpreting sizeof (*p) as being 1. That’s not portable to other compilers.
Is it possible to use pedantic warnings in GCC?
That is, every C89 compiler must accept strings of length 509; they are permitted to accept longer, but if you are being pedantic, it is not portable to use longer strings, even though a compiler is permitted to accept longer strings and, without the pedantic warnings, GCC will accept them too.
What is the purpose of adding-pedantic in C + +?
Adding -pedantic turns off more extensions and generates more warnings. For example, if you have a string literal longer than 509 characters, then -pedantic warns about that because it exceeds the minimum limit required by the C89 standard.