libgloss/arm/libcfunc.c: alarm [PATCH]
Schwarz, Konrad
konrad.schwarz@siemens.com
Fri Jul 15 08:23:00 GMT 2005
> -----Original Message-----
> From: newlib-owner@sources.redhat.com
> [mailto:newlib-owner@sources.redhat.com] On Behalf Of Shaun Jackman
> Sent: Thursday, July 14, 2005 9:46 PM
> Casting to (void) is legal C and is a common idiom [1] to
> explicitly point out that the coder does not intend to use
> the value of any particular expression, not just an unused
> identifier. For example, in libgloss/rs6000/sol-cfuncs.c the
> author has written...
> (void) write (2, msg, p-msg);
> ... and by casting to (void) has stated explicitly that he or
> she hasn't simply forgotten to check the return value of
> write(2) for an error, but that the correct response to an
> error in this case is to ignore it.
>
> I much prefer (void)identifier; to identifier=identifier;
> because the former is expressing exactly what I mean, "I do
> not care what the value of the following expression is."
> whereas the latter looks like a potentially meaningful operation.
Note that GCC has defines a variable attribute named unused intended for
marking variables unused.
(Personally, I feel that none of the original poster's stylistic
complaints are valid, though.)
More information about the Newlib
mailing list