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: Paul Eggert
Subject: Re: [Emacs-diffs] master 6cd5678: Clarify compiler-pacifier in frame.c
Date: Mon, 26 Aug 2019 12:09:32 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Eli Zaretskii wrote:

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.
That's not what UNINIT is for. It should be used only to pacify GCC. If GCC is 
happy with plain 'int x;' then UNINIT should not be used.
Furthermore, these use-before-set bugs are not "imaginary". In the typical case 
where GCC's -Wmaybe-uninitialized diagnostics are not false alarms, they are 
quite useful in spotting and fixing use-before-set bugs. I've fixed many that 
way myself, typically in my working copy as I develop code. Indeed, 'configure' 
enables -Wmaybe-uninitialized precisely because its utility outweighs its cost 
of a few false alarms and resulting need to use UNINIT or unnecessary 
initializations.
UNINIT can improve debugging, whereas unnecessary initializations can make the 
code look nicer. There's a tradeoff here, and different developers have 
different preferences of course. Developers who don't use tools that can take 
advantage of UNINIT may not appreciate or value its advantages.


reply via email to

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