6.1 Defines

LYRIC comes with a header file named Defines.hpp, which defines some usefull stuff. To stick to C++’s philosophy only a minimum amount of things have been defined.


  #include <lyric/Defines.hpp>


LYRIC_HERE is a macro that returns a string telling where we are in the code. It is extensively used by Assert (see Section 9.1) and by the Tracer module (see Section 6.3).
With a GNU compiler LYRIC_HERE gives the same result as the __PRETTY_FUNCTION__, the GNU-special macro.
With a non-GNU compiler (Visual Studio for example), LYRIC_HERE gives a string storing the source code file name and the line number in this source file, both separated with a column. Example: /lyric/src/String.cpp:235.

A special note for Microsoft Visual Studio users: Visual Studio sets debug information generation to Generate Debug Information Database for Edit and Continue as default for Debug targets. This option makes that the standard macro __LINE__ is no longer a macro but some strange variable. In this mode of debug information generation LYRIC_HERE will not give the expected output for line numbers. The trick is to set debug information generation to Generate Debug Information Database. This is a Visual Studio bug, not a wrong definition of the LYRIC_HERE macro, which respects Microsoft’s documentation1 about the preprocessor and standard macros.