Should we warn if we detect null derefernces or void value uses ?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 5 05:35:34 PST 2016


On 12/04/2016 11:41 PM, 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;
> }

No new warnings please. If something (such as the above) is definitely 
wrong - the code is not memory unsafe but is definitely in error - then 
just issue an error. That should be done whether or not the function is 
used in CTFE. -- Andrei


More information about the Digitalmars-d mailing list