On Fri, Dec 02, 2016 at 11:02:33AM -0700, Jeff Law wrote:
> It won't cause any problems in this and probably most instances, but leaving
> the code in its prior state is simply wrong from a maintenance standpoint.
> 
> I'd much rather have the code explicitly and safely handle the zero operands
> case so that if someone makes a change later they don't have to worry about
> whether or not they're accessing memory which was never allocated.
> 
> Additionally, it removes a false positive from the warning, thus making less
> noise.
> 
> It's not unlike the strictly unnecessary initializations we do to shut up
> -Wuninitialized.

But -Wuninitialized also found tons of real-world bugs.  Do we have a single
real-world example where such a warning would actually be useful (as in,
there would be an actual bug)?  Otherwise we are adding workarounds for a
warning that just forces people to add those workarounds, but doesn't
improve code in the wild in any way.

        Jakub

Reply via email to