如何在 Inno Setup 中正确编写下一个逻辑表达式?
How can I write the next logical expression in Inno Setup properly?
这是我需要使用预处理器指令编写的伪代码:
(IF VAR == NOT DEFINED) OR (VAR == DEFINED AND VAR == 0) THEN
{a few lines of code}
如何在一行中写出逻辑表达式?
我试过这个:
#if (defined(VAR) == 0) || ((defined(VAR) == 1) && (VAR == "0"))
但是没用。它说:
Undeclared identifier: "VAR".
你的代码看起来很合理。我本来希望它也能工作。
无论如何,您的代码给人的印象是“0”应该是 VAR
的默认值。所以应该这样做:
#ifndef VAR
#define VAR "0"
#endif
#if VAR == "0"
{a few lines of code}
#endif
这是我需要使用预处理器指令编写的伪代码:
(IF VAR == NOT DEFINED) OR (VAR == DEFINED AND VAR == 0) THEN
{a few lines of code}
如何在一行中写出逻辑表达式?
我试过这个:
#if (defined(VAR) == 0) || ((defined(VAR) == 1) && (VAR == "0"))
但是没用。它说:
Undeclared identifier: "VAR".
你的代码看起来很合理。我本来希望它也能工作。
无论如何,您的代码给人的印象是“0”应该是 VAR
的默认值。所以应该这样做:
#ifndef VAR
#define VAR "0"
#endif
#if VAR == "0"
{a few lines of code}
#endif