assert(condition[, message]) patch
Brad Roberts
braddr at puremagic.com
Mon Jul 31 11:09:01 PDT 2006
On Mon, 31 Jul 2006, Joseph Lisee wrote:
> In article <e5l5v8$1g7j$1 at digitaldaemon.com>,
> Tom S <h3r3tic at remove.mat.uni.torun.pl> wrote:
>
> > Lars Ivar Igesund wrote:
> > > Because not all the users will have access to the source, or be inclined to
> > > see it. Unless the user get's a readable/understandable assert message
> > > he/she might not get enough information to actually reproduce a test case
> > > for the developer to peruse.
> > >
> > > Walter, this is a no-brainer, please put it in.
> >
> > ++votes;
> >
> > /+
> > when you release your app to some testing team, you might want to leave
> > asserts in. While an error message containing the line number and
> > filename could be helpful, an additional message could be priceless.
> > E.g. assert(fileNameContainsNoSpaces(foo)); won't tell you that the
> > 'foo' really was something like '^&^34 5+23 3(43D678[SAFer6_[]' which
> > might mean some mem corruption or forgetting a .dup somewhere in your
> > code. You'd instead go searching for some logic problems that wouldn't
> > solve the problem.
> > +/
>
> I vote for the assert(condition, "msg"), construct as well.
>
> CXX Test and JUnit have spoiled me. You can't even do assert(1 == 0 &&
> "The laws of math have been changed"), which is trick I use in the C++
> all the time. Is having a message with the assert going to hurt
> anything?
>
> -Joseph Lisee
Um.. you're voting for a feature that was added several releases ago.
Later,
Brad
More information about the Digitalmars-d
mailing list