#include "iostream"
using namespace std;
struct command
{
char *name;
void (*function) (void);
};
#define COMMAND(NAME) {#NAME,NAME ## _command}
void quit_command()
{
std::cout<<"hello quit"<<std::endl;
}
void help_command()
{
std::cout<<"hello help"<<std::endl;
}
struct command mycommad[] =
{
COMMAND(quit),
COMMAND(help),
};
#define CC_BREAK_IF(cond) if(cond) break
int main()
{
mycommad[0].function();
mycommad[1].function();
return 0;
}
强悍的宏定义(#,##)
最新推荐文章于 2024-08-01 12:44:25 发布