"jacob navia" <jacob@[EMAIL PROTECTED]
> a écrit dans le message de news:
46a11369$0$25923$ba4acef3@[EMAIL PROTECTED]
> Hi
> I have extended lcc-win32 to recognize the syntax
>
> int fn(int a,int b,double)
> {
> // body of the function
> }
>
> This means that the third parameter is not used within
> the function.
>
> I would like to know your opinion about this extension before I
> generalize it in the next release.
Hi Jacob,
I don't have a strong opinion on whether you should advertise this
extension
in the next version and encourage its use. As far as I understand, it is
already part of C++ but not C99.
On the other hand, unused function parameters are quite common in C.
Having
to do***ent them with awkward UNUSED macros, pragmas, attributes or
similar
non ****table constructs is a pain. Worse even, using them in dummy
statements such as `(void)param;' is definitely ugly.
At first, I thought removing the parameter name was a good solution, but
it
tends to obfuscate the function prototype as the unused parameters' names
do
convey useful information. Consider for instance the main function: argc
and argv are redundant, one can process the command line using argv alone,
yet omitting argc in the prototype would look awkward:
int main(int, char *argv[]) {
...
}
My recommendation in this matter is to provide fine control over warning
generation as to allow users to disable the warning about "unused function
parameter" separately from other warnings about unused local variables,
static variables... If such is already the case, I think said warning
should be disabled by default, while others should be enabled. I don't
know
how such configuration can be passed to lcc-win32, but pragmas are not the
correct way to do this. Command line options or configuration files
(global
and/or project specific) are a much better solution.
Cheers,
Chqrlie.


|