-- Leo's gemini proxy

-- Connecting to republic.circumlunar.space:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Best GCC warning flags for compiling C++


A recent discussion on ACCU-general gave people an opportunity to share the warning flags they like to use with g++.


I thought I'd write down the consensus as I understood it, mainly for my own reference:


ACCU-general


-Wredundant-decls
-Wcast-align
-Wmissing-declarations
-Wmissing-include-dirs
-Wswitch-enum
-Wswitch-default
-Wextra
-Wall
-Werror
-Winvalid-pch
-Wredundant-decls
-Wmissing-prototypes
-Wformat=2
-Wmissing-format-attribute
-Wformat-nonliteral


We were advised by Jonathan Wakely that -Weffc++ is not very useful since it is mostly based on the first edition of the book Effective C++, many of whose recommendations were improved in the second edition, and also apparently GCC doesn't do a great job of warning about them.


Jonathan Wakely


Update: thanks to an article[1] by Roger Orr in CVu these flags are highly recommended in GCC 5.2+:


-flto
-Wodr


CVu


[1] Orr, Roger " One Definition Rule ", in CVu Volume 27, Issue 5 p16 (editor: Steve Love)


Originally posted at 2014-07-18 08:01:29+00:00. Automatically generated from the original post : apologies for the errors introduced.


One Definition Rule

original post

-- Response ended

-- Page fetched on Sun May 19 06:31:46 2024