次のコードがあります
#define PROC_ADD
void main(void)
{
while(1)
{
#ifdef PROC_ADD
// Do this code here then undefined it to run the code in the else
// processing work
#undef PROC_ADD
#else
// now that PROC_ADD has been undefined run this code
// processing work
#endif
}
}
ただし、コードは実行されます。ただし、が未定義になったelse
後はコードを実行しません。PROC_ADD
その理由は、コンパイル時にのみ定義および未定義にすることができ、実行時にはできないことが考えられると思います。しかし、よくわかりません。