DMD can implicitly convert class pointer to the bool. Is it bug or terrible feature?
Jonathan M Davis
jmdavisProg at gmx.com
Sun Nov 24 17:56:46 PST 2013
On Sunday, November 24, 2013 15:16:37 bearophile wrote:
> Maxim Fomin:
> > This is neither bug not a terribale feature.
>
> I think the implicit question of ilya-stromberg was: how much
> bug-prone is this language feature?
Not at all, and most people coming from C/C++ would likely be annoyed to not
have it. And a prime place that it's used where using is woludn't work is with
the in operator. e.g.
if(auto ptr = key in myAA) {...}
Granted, that's a pointer rather than a class reference, but it's essentially
the same issue. And I see no reason to have pointers and references act
differently in this regard.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list