questionable casts and other warnings
Using autobahn with the compiler flags that I typically use leads to a large list of errors. Among them are
- many old-style casts(-Wold-style-cast), some of which are used as const-casts (!) (-Wcast-qual)
- many shadowed variables (-Wshadow)
- missing default cases in switch statements (-Wswitch-default)
- implicit conversions, e.g. from unsigned long to int (!) (-Wconversion)
- ignored type qualifiers on functions (-Wignored-qualifiers)
This seems to conflict with the otherwise well written modern c++ code, so I think it should be fixed (as many of these warnings can indicate mistakes or bugs).
You should add -Wunused-variable to this list, among others I can't remember (not sitting at a terminal at the moment).
I do know, however, I cannot compile when using -Werror; which is a standard flag for many of the projects I work on personally and at work. I had seriously considered fixing many of these on my fork, but I haven't had the time to spare.
I just listet those, for which I saw some errors. Below is the full list I typically use for the gcc. It is very well possible to write code that produces no warnings with all of these flags, so I don't see a reason not to do so ;) (-Wunused-variable is included in -Wall)
-Wall -Wextra -pedantic -Wundef -Wunreachable-code -Wdisabled-optimization -Wcast-qual -Wsign-promo -Winit-self -Wnon-virtual-dtor -Woverloaded-virtual -Wconversion -Wfloat-equal -Wshadow -Wswitch-default -Wpacked -Wcast-align -Wold-style-cast -Wuseless-cast -Wlogical-op -Wtrampolines -Wnoexcept
-Wall is fine. If you want to get crazy, start making Boost compile with you excessive list of flags without warnings.
I do use boost and don't get any warnings. And everything I have described might not be a problem (yet), but some of them are mistakes. Even if you do have to handle some GiB of data such that the cast from unsigned long (std::size_t) to int is ever a problem... Similarly, claiming that a function returns a const bool is also a mistake simply because it is impossible for any function to do so.
@benhuber I see. Such casts are definitely questionable. So yeah, we should go over the code base and fix these things ..