All asserts need to have messages attached! Explicit as possible!

FoxyBrown via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 7 17:55:46 PDT 2017


I came across some error in heap sort. Was erroring out on the 
wrong. A few lines below the assert existed but no error message 
associated, why is it so hard to not write a few extra EXTREMELY 
helpful error messages?

assert(isHeap(r), "This is an ERROR AT THIS 
LOCATION"~__FILE__~"("~__LINE__~")");

etc?

It should be mandatory that all asserts, throws, etc provide 
correct information about not only the point of the error but 
also the location and what caused it. These things are not 
irrelevant but affect all those that use it... imagine the real 
human man hours that could be saved if such things were done.

It would be easy to find all the bad asserts?


More information about the Digitalmars-d mailing list