Infer assert() variables from condition

Issue #10 new
Anonymous created an issue

It would be great to directly infer the variables that made a condition fail, and print them without the need to specify them to the macro:

DBG_ASSERT(x + y > z), DBG_TAG(x), DBG_TAG(y), DBG_TAG(z);

would become:

assert(x+y>z);

where x, y and z would be automatically inferred. I know it is possible, because you can do it manually with GDB, but it probably requires a lot of effort. If you get it, I would suggest including the library in the Boost framework.

Comments (1)

  1. Edd Dawson repo owner

    This could only be done if debug information is present. The implementation would be very different for MSVC and DWARF emitting toolchains.

    It's a nice idea, but I doubt I'll ever find time for this particular undertaking. Feel free to have a go, though!

  2. Log in to comment