emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] master 6cd5678: Clarify compiler-pacifier in frame.c


From: Eli Zaretskii
Subject: Re: [Emacs-diffs] master 6cd5678: Clarify compiler-pacifier in frame.c
Date: Mon, 26 Aug 2019 21:39:17 +0300

> From: Óscar Fuentes <address@hidden>
> Date: Mon, 26 Aug 2019 20:20:23 +0200
> 
> Valgrind knows nothing about UNINIT as it works with machine code, not
> with source code. But AFAIK that macro is conditionally defined to "=0"
> (for silencing bogus gcc warnings) or to nothing (for leaving the
> variable uninitalized at the declaration point). The later allows
> Valgrind to do a proper check.
> 
> Simply changing
> 
> int x;
> 
> to
> 
> int x = 0;
> 
> just for silencing the gcc warning can hide a bug that Valgrind would
> detect otherwise.

This is backwards: it would mean we should use UNINIT all over the
place just to be sure we will be able to spot some imaginary bugs by
flipping a compiler switch.

The initialization in this case was added because GCC flagged a
potential use-before-define.  After that, there's no more bug for
Valgrind to find, so I see no reason to leave UNINIT around.

I could understand using UNINIT (or something similar) when the
developer has no idea what not initializing could cause.  But this is
not that case.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]