#include #include #define TEST_TARGET 7 #define TEST_STRING 1 #define TEST_CONSTCHAR 2 #define TEST_CHAR 4 #if (TEST_TARGET & TEST_STRING) void test(std::string str) { printf("std::string ->%s\n", str.c_str()); } #endif #if (TEST_TARGET & TEST_CONSTCHAR) void test(const char* str) { printf("const char* ->%s\n", str); } #endif #if (TEST_TARGET & TEST_CHAR) void test(char* str) { printf("char* ->%s\n", str); } #endif int main(int argc, char* argv[]) { #if (TEST_TARGET & TEST_STRING) test((std::string)"Hello, world!"); #endif #if (TEST_TARGET & TEST_CONSTCHAR) test((const char*)"Hello, world!"); #endif #if (TEST_TARGET & TEST_CHAR) test((char*)"Hello, world!"); #endif #if TEST_TARGET test("Hello, world!"); #endif }