if(arr) now a warning

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 10 04:59:31 PDT 2015


On Friday, 10 April 2015 at 11:39:59 UTC, Vladimir Panteleev 
wrote:
> https://github.com/D-Programming-Language/tools/pull/166/files
> I don't know the code well enough to know if arr != null would 
> be more appropriate.

It's probably a nitpick, I like arr!=null expression a lot, but 
currently compiler generates a horrible code for it: ldc 
generates comparison with typeinfos, and dmd inlines whole memcmp 
among other things instead of converting it to just arr.length!=0.


More information about the Digitalmars-d mailing list