3 ms·
Especially since there is a widely recognized way to ignore a parameter: (void) a; Every C programmer beyond weaning knows that.
by msla 10mo ago
Especially since there is a widely recognized way to ignore a parameter:
(void) a;
Every C programmer beyond weaning knows that.
- stefan_ 10mo agoI'm sure thats disallowed for the C-style cast.
- daringrain32781 10mo agoC++17 has the [[maybe_unused]] attribute.
- cpgxiii 10mo agoFwiw, unused-cast-to-void is a case that GCC and Clang ignore when using -Wno-old-style-cast, which is what most projects prohibiting C-style casts are going to be using (or whatever the equivalent their compiler provides).
- deleted 10mo ago[deleted]
- time4tea 10mo agoThe point really was that the unused method parameter should in almost all cases be removed, not that some trick should be used to make it seem used, and this is the wrong trick!
- addaon 10mo agoSometimes. But sometimes you have a set of functions that are called through function pointers that need the same signature, and one or more of them ignore some of the arguments. These days I’d spell that __attribute__((unused)); but it’s a perfectly reasonable case.
- bluGill 10mo ago#if otherbuild dosomething(param); #endif the above type of thing happens once in a while. nos the paramater is needed but the normal build doesn't use it