On 5 March 2017 at 23:36, Dave Gittins wrote: > Yes, the same logic would apply to all of them. I agree that the best > solution is to include what you use - but in the wild, on large > projects that use various libraries, it seems easy to overlook this > unless you have tools enforcing it. (I am of course saying that partly > to make myself feel better after I overlooked it...) I don't think > it's such a bad idea to put all the overloads into the global > namespace personally - given that *most* of them are there it is > unfortunately a common assumption that *all* of them are there. It's not the case that most are there, for <cmath> it's around a third of them (e.g. it declares three overloads of std::sin but only one of the three is also in the global namespace). > Alternatively, I wonder if gcc could warn for this? Presumably the > compiler will be aware that I am calling a function that was > "indirectly" declared in a C-library header, and therefore outside the > realm of standard-controlled behaviour? I don't know how hard that > would be to achieve, just wonder if it's a possibility. I think the compiler would have to have special cases for every function. I don't think your heuristic would work, because if you #include <stdlib.h> and call ::abs then it's still declared in a C-library header but there's no problem and no need to warn in that case.