]> git.donarmstrong.com Git - lilypond.git/commit
Make ASSERT_LIVE_IS_ALLOWED() behave as a function
authorGraham Percival <gperciva@gperciva-desktop.(none)>
Sat, 9 Oct 2010 17:47:22 +0000 (18:47 +0100)
committerGraham Percival <gperciva@gperciva-desktop.(none)>
Sun, 10 Oct 2010 15:56:32 +0000 (16:56 +0100)
commitedd898943a27a824915e2a042633e23b32756ab7
tree15aa2e34e4b03a150f3a0179fd8f2d1979988fdb
parent39a00d8cb0dcd209bf3068eb69ad59d31c7b4303
Make ASSERT_LIVE_IS_ALLOWED() behave as a function

David Kastrup helpfully pointed out that this macro expanded into
multiple statements, whereas it looks like a function call.  For
example, something like this:
  if (condition) ASSERT_LIVE_IS_ALLOWED(); else
could fail quite badly.

The "do {...} while (0)" is an idiom that compilers optimize away,
but allows the macro to behave as a function.
lily/include/smobs.hh