0

Currently using g++, Ubuntu 20.04 LTS, C++20.

So far, I've been coding with the following error/warning flags: -Wall -Wextra -Werror -pedantic

Do these flags generally cover every sub flag such as -Wvla, Weffc++, Wsign-conversion, etc ? Or does it depend on the system architecture and compiler? What other error flags should I be using?

spaL
  • 604
  • 7
  • 21
  • 3
    Does this answer your question? [How to turn on (literally) ALL of GCC's warnings?](https://stackoverflow.com/questions/11714827/how-to-turn-on-literally-all-of-gccs-warnings) – user17732522 Jan 06 '22 at 07:30
  • 1
    Above duplicate is for the first question of whether all warning subflags are covered. Answer: no; for the second question of recommendations, see e.g. https://stackoverflow.com/questions/5088460/flags-to-enable-thorough-and-verbose-g-warnings, although that might be a bit too opinion-based. Also https://stackoverflow.com/questions/399850/best-compiler-warning-level-for-c-c-compilers, https://stackoverflow.com/questions/5283894/recommended-w-flags-for-building-c-with-gcc and probably more. – user17732522 Jan 06 '22 at 07:32
  • [Options to Request or Suppress Warnings](https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html) – Evg Jan 06 '22 at 07:32
  • Flags are not defined by the language, and are specific to a compiler. Some well known flags (-c, -o, -C) are rather historic because they existed in the first C compiler from Kernighan and Ritchie. Most of the `-W` flags were added later and included in the (now rather old) Gnu compiler. Clang is more recent that gcc and in order not to disturb users decided to copy most flags from gcc. But MSVC has a quite different set of flags before it shares no common history with gcc. – Serge Ballesta Jan 06 '22 at 07:37

0 Answers0