Geoff Chappell - Software Analyst
positive:
/GX
negative:
/GX-
The positive and negative forms override each other, of course. Additionally, the /GX option
and the /GX- option overrides /D_CPPUNWIND, /EHa and /EHs.
Neither /GX nor /GX- passes to any compiler module.
A _CPPUNWIND macro defined implicitly by /GX is undefined without warning by a subsequent /EHa- or /EHs- (as well as by a subsequent /U_CPPUNWIND or by /u anywhere).
The /GX option resolves entirely in terms of other options /EHa, /EHc, /EHs and /D_CPPUNWIND.
In isolation, /GX produces /EHs /EHc /D_CPPUNWIND for the front-end C++ compiler and /EHs for the back-end compiler. However, the product documentation’s description of /GX as equivalent to /EHsc (a combined option, expanding to /EHs /EHc) is not strictly correct. The two have different relations with other options.
For example, the combination /GX /EHs- lets /EHc pass alone to the front-end C++ compiler without warning, in effect with /EHs- overriding silently the /EHs that is weakly implied by /GX, but the supposedly equivalent /EHsc /EHs- causes two warnings, one as /EHs- overrides (the now explicit) /EHs and a second as the (also explicit) /EHc is discarded for lack of a prerequisite:
Options | Warnings and Errors | Front-End | Back-End |
---|---|---|---|
/GX /EHs- | none | -EHc | nothing |
/EHsc /EHs- | D4025 and D4007 | nothing | nothing |
Similarly, in the combination /EHa /GX, the /EHs that is weakly implied by /GX is overridden by the preceding (explicit) /EHa, so that -EHa passes to the compiler modules, but in the supposedly equivalent /EHa /EHsc, the /EHs is now explicit and overrides the /EHa, so that not withstanding the warning it is now -EHs that passes to the compiler modules:
Options | Warnings and Errors | Front-End | Back-End |
---|---|---|---|
/EHa /GX | none | -EHa -EHc -D_CPPUNWIND | -EHa |
/EHa /EHsc | D4025 | -EHs -D_CPPUNWIND -EHc | -EHs |