Re: c++ operator << support for debug()()

From: Alan Barrett <apb@dont-contact.us>
Date: Mon, 7 Jul 2003 15:39:23 +0200

On Mon, 07 Jul 2003, Robert Collins wrote:
> Interestingly though, my testcases (in test-suite/debug.cc in the
> branch) use a trailing semicolon quite happily.

The extra trailing semicolon is seen by the compiler as a null
statement. It's usually harmless, but can cause trouble sometimes. Try
this:

        if (something)
                debugs(x,y)("foo");
        else
                debugs(x,y)("bar");

and I think you'll get an error in the "foo" line with your original
macros, but not with the "do { ... } while (0)" version.

--apb (Alan Barrett)
Received on Mon Jul 07 2003 - 07:40:16 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:20:15 MST