At Fri, 5 Jul 2024 10:03:05 -0400 (EDT), Mouse <mo...@rodents-montreal.org> 
wrote:
Subject: Re: compilers and unused args in functions
>
> One is
>
>       (void)arg;

This is, in my opinion, the one correct way to explicitly and with
intent "use" an otherwise unused variable or parameter.

It is after all idiomatic C when used with more complex expressions,
such as function calls.

Here "arg" is a valid expression, and a "(void)" cast discards or
ignores the result of an expression.

The abstraction of __USE() seems unnecessary and more difficult to read.

--
                                        Greg A. Woods <gwo...@acm.org>

Kelowna, BC     +1 250 762-7675           RoboHack <wo...@robohack.ca>
Planix, Inc. <wo...@planix.com>     Avoncote Farms <wo...@avoncote.ca>

Attachment: pgpfRscm28euy.pgp
Description: OpenPGP Digital Signature

Reply via email to