This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Preprocessor Directives
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Sep 22, 2011
06:23 PM
Preprocessor Directives
I am observing that #else condition is firing even if #if is satisfied.
Project Type: InstallScript project
Snippet of my code in Setup.Rul:
#define FOO 1
#if (FOO = 1)
MessageBox("FOO = 1",INFORMATION);
#elif (FOO = 2)
MessageBox("FOO = 2",INFORMATION);
#elif (FOO = 3)
MessageBox("FOO = 3",INFORMATION);
#else
MessageBox("FOO = something else",INFORMATION);
#endif
Two message boxes pop-up with messages "FOO = 1" and "FOO = something else".
Has anyone observed this behavior?
Thanks
Project Type: InstallScript project
Snippet of my code in Setup.Rul:
#define FOO 1
#if (FOO = 1)
MessageBox("FOO = 1",INFORMATION);
#elif (FOO = 2)
MessageBox("FOO = 2",INFORMATION);
#elif (FOO = 3)
MessageBox("FOO = 3",INFORMATION);
#else
MessageBox("FOO = something else",INFORMATION);
#endif
Two message boxes pop-up with messages "FOO = 1" and "FOO = something else".
Has anyone observed this behavior?
Thanks
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Sep 29, 2011
12:11 PM
This is a known issue with the InstallScript compiler's preprocessing support that was previously reported in work order IOA-000012862.
You can work around this behavior by replacing any '#else' statements in a preprocessor block that contains any #elif statements with:
#elif 1
This should also work anywhere #else is used, but is really only necessary as a workaround in preprocessor blocks like the one in your post.
This issue occurs due to how the compiler handles the #else after an #if or #elif was true, and a subsequent #elif was found. Replacing #else with #elif 1 avoids this behavior.
You can work around this behavior by replacing any '#else' statements in a preprocessor block that contains any #elif statements with:
#elif 1
This should also work anywhere #else is used, but is really only necessary as a workaround in preprocessor blocks like the one in your post.
This issue occurs due to how the compiler handles the #else after an #if or #elif was true, and a subsequent #elif was found. Replacing #else with #elif 1 avoids this behavior.