defineを使って名前空間を定義します.
defineを使って名前空間を定義します.
#include
#define MSG(sym) msg_ ## sym //
struct MSG(BoardConfiguration){
int num;
const char *name;
};
struct MSG(HostConfiguration){
int num;
const char *name;
};
int main()
{
MSG(BoardConfiguration) conf;
conf.num = 10;
conf.name = "Tom";
MSG(HostConfiguration) conf_h;
conf_h.num = 10;
conf_h.name = "Tom";
printf("Board: num:%d, Name:%s.
", conf.num, conf.name);
printf("HOST: num:%d, Name:%s.
", conf_h.num, conf_h.name);
return 0;
}