All asserts need to have messages attached! Explicit as possible!
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jul 10 06:52:22 PDT 2017
On 2017-07-10 15:45, Jonathan M Davis via Digitalmars-d wrote:
> That only helps if there's something to describe. Often, it's something like
>
> assert(!range.empty);
>
> in which case, there really isn't much to say. I totally agree that
> assertion messages can be helpful when there's something to explain, but
> there often really isn't, and all a message is going to do is repeat the
> condition being checked in English, which is just pointless text.
Well, in this case it could include why the range cannot be empty. But
in the case of ranges it's pretty clear, if you know how the whole range
concept works.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list