whisperity added a comment.

In D106431#2896334 <https://reviews.llvm.org/D106431#2896334>, @aaron.ballman 
wrote:

> In D106431#2896206 <https://reviews.llvm.org/D106431#2896206>, @whisperity 
> wrote:
>
>> The problem with enums is that translating //zero// (0, 0.0, nullptr, 
>> etc...) to the enum case is not always apparent. A warning **should** always 
>> be given. And //if// you can find a zero member in the enum, we can report 
>> an automated suggestion for that.
>
> I think we shouldn't give any fix-it for enumerations. Zero doesn't always 
> mean "the right default value" -- for example, another common idiom is for 
> the *last* member of the enumeration to be a sentinel value.

I agree with you, but we need to consider that the checker works in a way that 
it gives the "zero" for integers. If we are here, was that the right decision? 
I mean... I wonder how much //consistency// we should shoot for. (`nullptr` for 
the pointers as default is at least somewhat sensible.)

But definitely, the //warning// must be given, that is true.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106431/new/

https://reviews.llvm.org/D106431

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to