empty arrays and cast(bool): WAT

Jonathan M Davis jmdavisProg at gmx.com
Sat Feb 18 19:40:39 PST 2012


On Sunday, February 19, 2012 04:33:14 Timon Gehr wrote:
> Why? (step back a moment and stop thinking about what you know about
> DMDs implementation semantics and then answer)

Because of the whole nonsense of null and empty being treated the same in some 
circumstances and not in others. I'm immediately suspicious of any arry code 
which doesn't expcitly check for empty or null but relies on stuff like 
cast(bool)arr. The odds are too high that the programmer meant one and got the 
other.

- Jonathan M Davis


More information about the Digitalmars-d mailing list