Should we warn if we detect null derefernces or void value uses ?
Daniel Kozak via Digitalmars-d
digitalmars-d at puremagic.com
Sun Dec 4 23:45:48 PST 2016
Dne 5.12.2016 v 08:39 Stefan Koch via Digitalmars-d napsal(a):
> On Monday, 5 December 2016 at 07:25:20 UTC, Daniel Kozak wrote:
>> Dne 5.12.2016 v 06:03 Stefan Koch via Digitalmars-d napsal(a):
>>
>>> On Monday, 5 December 2016 at 04:59:01 UTC, ketmar wrote:
>>>> On Monday, 5 December 2016 at 04:41:55 UTC, Stefan Koch wrote:
>>>>> Hi Guys,
>>>>> What is your opinion, should we warn if we unambiguously detect
>>>>> something that is clearly unwanted ?
>>>>>
>>>>> int fn(int y)
>>>>> {
>>>>> int x = void;
>>>>> ++x;
>>>>> return x+y;
>>>>> }
>>>>>
>>>>> This requires data-flow analysis (The same kind that tells you if
>>>>> you are skipping a statement)
>>>>> And will slow down compilation a little if we enable such a warning.
>>>>
>>>> no need to. if i explicitly wrote `=void` there, i know what i am
>>>> doing. maybe i want that UB. or something. and i tried to tell the
>>>> compiler STFU. please, don't make it harder, and don't force me to
>>>> invent another ways to say STFU.
>>>
>>> Even if you want that ub.
>>> A warning will not halt the compilation.
>> Yes, but still will be there. I always try to have no warnings, maybe
>> as a special compilation flag could enable this.
>
> It will warn on something that is almost always bad!
https://github.com/g0tmi1k/debian-ssh#information
More information about the Digitalmars-d
mailing list