DMD can implicitly convert class pointer to the bool. Is it bug or terrible feature?
ilya-stromberg
ilya-stromberg-2009 at yandex.ru
Sun Nov 24 06:32:15 PST 2013
On Sunday, 24 November 2013 at 14:16:39 UTC, 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?
Yes, exactly. I personally was VERY surprised. My code example
from real life:
class Foo
{
}
class Bar
{
Foo f;
void bar()
{
//variable was wrongly commented here
//bool f = true;
if(f)
{
//Oops!
}
}
}
More information about the Digitalmars-d
mailing list