C++ guys hate static_if?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Mar 14 10:26:18 PDT 2013


On 3/14/13 1:15 PM, Dicebot wrote:
> On Thursday, 14 March 2013 at 17:09:41 UTC, Andrej Mitrovic wrote:
>> On 3/14/13, bearophile <bearophileHUGS at lycos.com> wrote:
>>> This is an invalid argument. You can say the same thing for many
>>> (most?) tests done by the compiler. Unit tests can't be sure to
>>> verify all code paths inside a function or template.
>>
>> No, it must do exactly that. If you have so many paths that you can't
>> reasonably test all paths then your template or function is too
>> complicated to begin with. The benefit here of D over C++ is that unit
>> testing is cheap and doesn't require external libraries.
>>
>> You use template constraints to limit the code paths, and you use
>> unittests to verify semantics. Then there's also static assert(0).
>
> Does Phobos pull request tester turns red on failed 100% coverage?
> (sarcasm intended)

Walter has measured coverage of Phobos unittests a couple of times, it's 
very high. But I agree it would be nice to have it as a target.

Andrei


More information about the Digitalmars-d mailing list