lkml.org 
[lkml]   [2017]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/

* Arnd Bergmann <arnd@arndb.de> wrote:

> > So I think we should consider it a syntactic construct to avoid.
>
> Unused variables are relatively harmless compared to used-uninitialized
> variables that are always bugs (though they are provably impossible to
> detect correctly in some cases).

So the thing I was most worried about was that old GCC used to not warn about:

long __maybe_unused error;

...

if (error)
return error;

... but recent GCC does warn if it's certain that the use is uninitialized, so the
scenario I outlined should not happen.

But it will supress the warning if the variable is uninitialized but GCC cannot
prove it for sure, so my point remains that it's a potentially dangerous
construct.

Thanks,

Ingo

\
 
 \ /
  Last update: 2017-06-22 20:01    [W:0.048 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site