tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: compilers and unused args in functions



At Fri, 5 Jul 2024 10:03:05 -0400 (EDT), Mouse <mouse%Rodents-Montreal.ORG@localhost> 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 <gwoods%acm.org@localhost>

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

Attachment: pgp1_aksaZk2B.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index