2015年5月20日水曜日

macro

引数つきのmacroについて

以下のように、macroに引数を定義することが可能。うけとった引数の処理は続けて()に記述できる。

//
// macro.cpp
// CplusplusPractice
//
// Created by masai on 2015/05/20.
// Copyright (c) 2015年 masai. All rights reserved.
//
#include <iostream>
#include <typeinfo>
#include <cxxabi.h>
#define CMACRO(x) (void)(x)
int main(int argc, const char * argv[]) {
std::cout << "con1.data = " << abi::__cxa_demangle(typeid(CMACRO(12)).name(), 0, 0, 0) << std::endl;
return 0;
}
view raw macro.cpp hosted with ❤ by GitHub

0 件のコメント:

コメントを投稿