Add macro that creates unique variable names

This commit is contained in:
Danny Robson 2012-04-12 14:06:59 +10:00
parent 57bc1af1ae
commit 40267cad05

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with libgim. If not, see <http://www.gnu.org/licenses/>. * along with libgim. If not, see <http://www.gnu.org/licenses/>.
* *
* Copyright 2010 Danny Robson <danny@blubinc.net> * Copyright 2010-2012 Danny Robson <danny@blubinc.net>
*/ */
#ifndef __DEBUG_HPP #ifndef __DEBUG_HPP
@ -28,6 +28,10 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#define CONCATENATE_DETAIL(x, y) x##y
#define CONCATENATE(x, y) CONCATENATE_DETAIL(x, y)
#define raii CONCATENATE(unique, __COUNTER__)
#define trace { \ #define trace { \
std::cerr << __FILE__ << ":" << __func__ << ":" << __LINE__ << std::endl; \ std::cerr << __FILE__ << ":" << __func__ << ":" << __LINE__ << std::endl; \
} }