Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
March 14, 2004 printf_assert | ||||
---|---|---|---|---|
| ||||
We could really do with a printf_assert(), in order to print out details of asserts and assert in a single statement |
March 14, 2004 Re: printf_assert | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | >We could really do with a printf_assert(), in order to print out details of asserts and assert in a single statement
>
I'd prefer:
assert foo == bar, "foo=$foo bar=$bar";
or (Java-like):
assert foo == bar : "foo " ~ foo ~ " bar=" ~ bar;
|
March 14, 2004 Re: printf_assert | ||||
---|---|---|---|---|
| ||||
Posted in reply to Piotr Fusik | Piotr Fusik wrote: >>We could really do with a printf_assert(), in order to print out details of >>asserts and assert in a single statement >> > > I'd prefer: > assert foo == bar, "foo=$foo bar=$bar"; > or (Java-like): > assert foo == bar : "foo " ~ foo ~ " bar=" ~ bar; > I'd prefer: assert(x==1, "x: %d", x); assert(testExpression, formattingString, ...); (I like the parentheses on assert.) I think adding optional output options on assert would be great. I think I'd use it often. -- Justin http://jcc_7.tripod.com/d/ |
March 14, 2004 Re: printf_assert | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | "J C Calvarese" <jcc7@cox.net> wrote in message news:c31vsi$vo6$1@digitaldaemon.com... > Piotr Fusik wrote: > >>We could really do with a printf_assert(), in order to print out details of > >>asserts and assert in a single statement > >> > > > > I'd prefer: > > assert foo == bar, "foo=$foo bar=$bar"; > > or (Java-like): > > assert foo == bar : "foo " ~ foo ~ " bar=" ~ bar; > > > I'd prefer: > assert(x==1, "x: %d", x); > > assert(testExpression, formattingString, ...); That's a good suggestion. I've spent heaps of time putting printf stuff in and around invariants this w/e, as I've been working on DTL containers. Lists were especially assertive ... ;) > (I like the parentheses on assert.) Indeed. |
March 14, 2004 Re: printf_assert | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | J C Calvarese wrote: > I'd prefer: > assert(x==1, "x: %d", x); > > assert(testExpression, formattingString, ...); > > (I like the parentheses on assert.) > > I think adding optional output options on assert would be great. I think I'd use it often. Me too. It's just common sense that assert with printf functionality would look like this. C/C++ programmers will instantly know how to use this. -- -Anderson: http://badmama.com.au/~anderson/ |
Copyright © 1999-2021 by the D Language Foundation