Yet another slap on the hand by implicit bool to int conversions
bearophile
bearophileHUGS at lycos.com
Mon Jun 20 07:40:36 PDT 2011
Steven Schveighoffer:
> I don't think this is a good idea. Generic code could result in an error
> where there shouldn't be. For example:
>
> int foo(T)()
> {
> if(T.sizeof == char.sizeof)
> ...
> }
>
> Would this fail to compile where T == char? What about if T == ubyte?
I was thinking more about a warning than an error. But you are right, my enhancement request 5540 seems premature, I/we have to think some more about it.
Bye and sorry,
bearophile
More information about the Digitalmars-d
mailing list