[m-rev.] for review: speed up the declarative debugger
Zoltan Somogyi
zs at cs.mu.OZ.AU
Thu Aug 4 07:53:28 AEST 2005
On 04-Aug-2005, Ian MacLarty <maclarty at cs.mu.OZ.AU> wrote:
> This change makes the declarative debugger 12.7% faster on a session
> which uses divide and query on the Mercury compiler to find a bug in a
> leaf node.
Thanks. Please commit the tools you used to measure this.
> Just curious: why do we normally put macros in "do { ... } while(0)"
> instead of just "{ ... }"?
This is an old C trick: it is the only way you can make sure that the
macro invocation is syntactically identical to a statement. With just
plain {} wrapping the macro body, code such as
if (...)
invoke_macro();
else
...
would do the wrong thing, because the } at the end of the text replacing
invoke_macro would end the then-part of the if-then-else and the following
semicolon would be a null statement that ends the if-then-else as a whole;
the else would become a syntax error.
Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list