4 ms·
> with file specific flags But you don't want to disable warnings throughout the file, just locally. > Then you don't have non-portable cruft littering the c
by einpoklum 2y ago
> with file specific flags
But you don't want to disable warnings throughout the file, just locally.
> Then you don't have non-portable cruft littering the code,
You can make it perfectly portable, with a little macro work. See, ,for example:
https://github.com/eyalroz/printf/blob/013db1e345cbb166a7eb758da2b4edba93ad2458/test/test_suite.cpp#L138 https://github.com/eyalroz/printf/blob/013db1e345cbb166a7eb7...
(this is from the standalone-no-libc-printf-family-implementation I maintain; the library is C, the test suite is C++ but it doesn't matter for the purposes of my point here.)
and that you only need to do once in your project (you can make it your own header). Even when it comes to use - you can place your warning-disabling within another macro, so that you end up only using a simple single macro for your actual code.