The RAII design pattern can be utilized to create simple and intuitive logging facilities, like the one we will present now. Through the useful macro LOG_FUNC, the proposed ScopeLogger will easily create function call graphs at run time, to allow easy debugging and tracking of program execution.
In this post I will introduce a common problem you are likely to bump into when inheriting from templated base classes.
C++ provides a mechanism that allows any function to declare exactly which exception types it may throw, and these declarations are actually enforced in runtime. We will review exactly how this mechanism works, and why it is usually left unused.
How would you like the next piece of code?
??=include <iostream> ??=define A "hey" int main () ??< char x??(??) = A; if (0 ??' 1) std::cout << x << std::endl; // what do you say about this code??/ std::cout << "amusing" << std::endl; ??>