Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #88323
| From | Paavo Helde <eesnimi@osa.pri.ee> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: g++ -c -Werror -Weverything exercise_2_17.cpp |
| Date | 2022-12-31 18:50 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <topp83$12far$1@dont-email.me> (permalink) |
| References | (1 earlier) <toktj3$bqr$3@gioia.aioe.org> <tol0b7$dnjr$1@dont-email.me> <tonjq0$ihs$1@gioia.aioe.org> <tonlf4$p0hj$1@dont-email.me> <topj40$hak$1@gioia.aioe.org> |
31.12.2022 17:05 Juha Nieminen kirjutas: > Paavo Helde <eesnimi@osa.pri.ee> wrote: >> Sure, these are probably specific to our codebase: >> >> -Wno-missing-field-initializers -Wno-unused-parameter >> -Wno-unused-local-typedefs -Wno-deprecated-declarations -Wno-parentheses >> >> The first one is there probably because we have many classes whose >> members are often not initialized by the constructions, but later, by >> the framework. > > I think that using [[maybe_unused]] is better than disabling the warning > because it more explicitly indicates that it being unused is not a mistake > and the programmer was aware of it. You are right in that the unused parameter warnings should be dealt case-by-case instead of a global compiler option. I guess there was no time or willingness to do that when the compiler suddenly started to spit out hundreds of such warnings, and after adding the global option there has been no motivation to do that. Still, I'm not convinced [[maybe_unused]] is the best solution always. As far as I can see, this is meant more for conditional compilation, where a thing might be indeed sometimes used and sometimes not, depending on preprocessor macro definitions. In my code, I get this warning mainly for virtual function overrides where some parameter is e.g. only used by 1 override of 10. And in those 9 other overrides the parameter is not maybe unused, but definitely unused. Alas, by some reason there is no [[unused]] attribute. In this scenario, I believe it might be better (i.e. more readable) to just delete or comment out the parameter name, it will have the same effect.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
g++ -c -Werror -Weverything exercise_2_17.cpp "gdo...@gmail.com" <gdotone@gmail.com> - 2022-12-27 01:22 -0800
Re: g++ -c -Werror -Weverything exercise_2_17.cpp Öö Tiib <ootiib@hot.ee> - 2022-12-27 02:50 -0800
Re: g++ -c -Werror -Weverything exercise_2_17.cpp Juha Nieminen <nospam@thanks.invalid> - 2022-12-29 20:33 +0000
Re: g++ -c -Werror -Weverything exercise_2_17.cpp Paavo Helde <eesnimi@osa.pri.ee> - 2022-12-29 23:20 +0200
Re: g++ -c -Werror -Weverything exercise_2_17.cpp Juha Nieminen <nospam@thanks.invalid> - 2022-12-30 21:05 +0000
Re: g++ -c -Werror -Weverything exercise_2_17.cpp Paavo Helde <eesnimi@osa.pri.ee> - 2022-12-30 23:33 +0200
Re: g++ -c -Werror -Weverything exercise_2_17.cpp Juha Nieminen <nospam@thanks.invalid> - 2022-12-31 15:05 +0000
Re: g++ -c -Werror -Weverything exercise_2_17.cpp David Brown <david.brown@hesbynett.no> - 2022-12-31 16:40 +0100
Re: g++ -c -Werror -Weverything exercise_2_17.cpp Juha Nieminen <nospam@thanks.invalid> - 2023-01-03 06:27 +0000
Re: g++ -c -Werror -Weverything exercise_2_17.cpp David Brown <david.brown@hesbynett.no> - 2023-01-03 08:51 +0100
Re: g++ -c -Werror -Weverything exercise_2_17.cpp Juha Nieminen <nospam@thanks.invalid> - 2023-01-03 09:13 +0000
Re: g++ -c -Werror -Weverything exercise_2_17.cpp David Brown <david.brown@hesbynett.no> - 2023-01-03 11:47 +0100
Re: g++ -c -Werror -Weverything exercise_2_17.cpp Paavo Helde <eesnimi@osa.pri.ee> - 2022-12-31 18:50 +0200
Re: g++ -c -Werror -Weverything exercise_2_17.cpp David Brown <david.brown@hesbynett.no> - 2022-12-31 18:47 +0100
csiph-web