5 ms·
If you make one small change to this file you can cause clang and gcc to both prevent this from compiling if you are using warnings. namespace { void Nev
by beatbrokedown 9y ago
If you make one small change to this file you can cause clang and gcc to both prevent this from compiling if you are using warnings.
namespace {
void NeverCalled() { Do = EraseAll; }
}
or marking NeverCalled as static itself.
Results in warning: unused function NeverCalled.
In general this is best practice for functions defined and used in a single translation unit.
- saalweachter 9y agoThat's a vital part of the setup. You could hypothetically link this compilation unit against another unit which included: void NeverCalled(); struct A { A() { NeverCalled(); } }; A a;
- Annella 9y agoVery interesting. Thank you for sharing this!