3 ms·
I completely disagree. It's true that some of the warnings it enables aren't terribly useful, but being able to enable all warnings is very helpful instead of h
by halosghost 11y ago
I completely disagree. It's true that some of the warnings it enables aren't terribly useful, but being able to enable all warnings is very helpful instead of having to manually list ~40 flags. Additionally, -Wpadded and the like are actually helpful for optimizations.
Plus, writing code (in C, I cannot speak for Cxx) which results in no warning output from `-Weverything` is actually not that difficult to do, and generally the result is that you've written more robust code in the process. A lot of projects are now trying to move to compile with `-Weverything` and not disable any warnings, and I personally think it's a great move.
- jeorgun 11y agoFor C, I'd agree that it's useful. The flags I listed have issues specifically for C++. -Wc++98-compat, on a C++11 or C++14 project, is about as helpful as you'd expect. -Wpadded is triggered pretty reliably by subclassess. And so forth. Of course it is possible to specifically disable useless warnings, but in my experience it's just as easy to add a reasonable selection of flags (say, -Wall -Wextra -Wold-style-cast -Wconversion -Wsign-conversion) than to start with -Weverything and work backwards. Still, it has been some time since I've tried using it; maybe I ought to give it another chance.
- halosghost 11y agoI do not personally code in Cxx (which is why I refrained from making judgements about `-Weverything`'s use for it earlier). But, at least for C, almost all the warnings you get are helpful (with very few exceptions). At most, I end up disabling two or three warnings from `-Weverything` on my projects. And, personally, I prefer to use pragmas inside the code rather than flags to disable them; that way, I can explicitly declare in my code that I have intentionally done something which would raise a warning (as close to the actual something as possible rather than generally disabling it). The result is that I still get the warnings for wherever I did not intentionally invoke these actions and still get all the other warnings that I should pay attention to for best practices. Though I would personally argue for most people (particularly new C coders) using `-Weverything` wherever possible, if you see fit not to, that's your choice :)
- cpeterso 11y agoHere's a detailed explanation of -Weverything from a clang developer. He says -Weverything is intended for clang developers' own testing. He recommends using -Wall -Wextra plus any individual warnings you may want. http://programmers.stackexchange.com/a/124574 http://programmers.stackexchange.com/a/124574 clang does not document its warning flags like gcc does, but a long (but now incomplete) list is available here: http://fuckingclangwarnings.com/ http://fuckingclangwarnings.com/
- semi-extrinsic 11y agoThe -Wmaybe-uninitialized flag can produce loads of false positives, and may not be very useful (depending on your code). The really interesting part is that a compiler that gives 100% correct warnings about using uninitialized variables can be proven to be able to solve the halting problem, thus it cannot exist.
- emn13 11y agoThen again, if you construct your code such that determining whether a variable is initialized requires solving the halting problem, somebody should probably take your keyboard away :-). In practice, if your initialization isn't sufficiently transparent, you're just busy making bugs.