On 2019-02-02, Andrew C Aitchison via Exim-dev <exim-dev@???> wrote:
> On Sat, 2 Feb 2019, admin--- via Exim-dev wrote:
>
>> https://bugs.exim.org/show_bug.cgi?id=2368
>>
>> Jeremy Harris <jgh146exb@???> changed:
>>
>> What |Removed |Added
>> ----------------------------------------------------------------------------
>> Resolution|--- |WONTFIX
>> Assignee|nigel@??? |jgh146exb@???
>> Status|NEW |RESOLVED
>>
>> --- Comment #1 from Jeremy Harris <jgh146exb@???> ---
>> This is a matter for choosing compiler switches to avoid doing such static
>> analysis. We refuse to endlessly chase such things by using more-and-more
>> convoluted coding. Even the cast-to-void could be regarded as such an
>> attempt, but it least its heritage goes back over thirty years.
> This patch makes the code clearer,
> and makes it explicit that we know what we are doing.
> If it makes that the compiler happy at the same time,
> then we can leave the switches set in a way that helps us avoid writing
> new bugs.
If the optimizer does not spot it you have code that wastes resources
(albeit a small amount in this case). Also now you have two variables
that are assigned a value which is not used: this is potentially another
static analysis violation. (gcc would find that at optimisation level
2 last time I checked)
casting the function result to void is the traditional way to
silence the unused return value warnings:
/* ignoring the return values here because nothing can be done if this fails */
(void) write(fd, process_info, process_info_len);
(void) close(fd);
--
When I tried casting out nines I made a hash of it.