Detect uninitialized class var access
Paul Backus
snarwin at gmail.com
Sun Sep 25 11:22:15 UTC 2022
On Sunday, 25 September 2022 at 03:04:45 UTC, Tejas wrote:
> On Saturday, 24 September 2022 at 23:04:00 UTC, rassoc wrote:
>> On 9/24/22 15:28, Adam D Ruppe via Digitalmars-d-learn wrote:
>>> gdb --args ./your_program
>>>
>>> and then it will tell you all the details you want to know
>>> about when this happens.
>>
>> Thank you for your input, Adam. Real shame that there's no
>> built-in compiler solution and probably never will be
>> according to [1]. :(
>>
>> [1] https://issues.dlang.org/show_bug.cgi?id=4595
>
> AFAIK diagnostics like that are not possible because Walter
> doesn't want to implement full blown dataflow analysis in the
> compiler since it will slow down the compilation speed of dmd
Implementing such a diagnostic is equivalent, in the general
case, to solving the halting problem. So even with dataflow
analysis, there would always be cases where the compiler either
fails to detect a potential null dereference (false negative), or
detects one that can't actually happen at runtime (false
positive).
More information about the Digitalmars-d-learn
mailing list