NO_EXT_KEYS and strict ISO/ANSI modes

B

Bart Oldeman

Hi,

Open Watcom C defines NO_EXT_KEYS if you use it with -za ("disable
extensions (i.e., accept only ISO/ANSI C)"), but isn't this a
contradiction in itself; it's not in the implementation defined namespace
after all.

This code for example

int foo(void)
{
return NO_EXT_KEYS;
}

compiles happily. As far as I understand though this macro has been there
for a long time for MS compatibility so it can't be that easily removed.

My question is: do recent MS C compilers or other common compilers still
define this macro too? I just know that GCC doesn't -- it defines
__STRICT_ANSI__ instead.

We are considering to remove its definition from Open Watcom for the new
-za99 switch, well C99 support is far from complete but a switch similar
to GCC's -std=c99 is still needed.

Bart
 
R

Régis Troadec

"Bart Oldeman" <[email protected]> a écrit dans le
message de
Hi,
Hi,


Open Watcom C defines NO_EXT_KEYS if you use it with -za ("disable
extensions (i.e., accept only ISO/ANSI C)"), but isn't this a
contradiction in itself; it's not in the implementation defined namespace
after all.

It's off-topic here since ISO C doesn't define NO_EXT_KEYS, but see below...
This code for example

int foo(void)
{
return NO_EXT_KEYS;
}
compiles happily. As far as I understand though this macro has been there
for a long time for MS compatibility so it can't be that easily removed.

My question is: do recent MS C compilers or other common compilers still
define this macro too? I just know that GCC doesn't -- it defines
__STRICT_ANSI__ instead.

I specified the option flag /Za and tried to compiled code below with MSVC
6.0 (cl version : 12.00.8168) which is not a recent MS compiler anymore:

/*1:*/ int main(void)
/*2:*/ {
/*3:*/ return NO_EXT_KEYS;
/*4:*/ }
/*5:*/

and got:
c:\main.c(3) : error C2065: 'NO_EXT_KEYS' : undeclared identifier

I took a look at my MSDN documentation and found that NO_EXT_KEYS was
defined only if /Za was specified, but for 16-bit versions of the MS
compiler cl. It's not clear in the doc but it appears that this macro did'nt
subsist anymore in 32-bit versions of cl.

Regis
 
A

Alan J. McFarlane

Régis Troadec said:
"Bart Oldeman" <[email protected]> a écrit dans
le message de
Open Watcom C defines NO_EXT_KEYS if you use it with -za ("disable
extensions (i.e., accept only ISO/ANSI C)"), but isn't this a
contradiction in itself; it's not in the implementation defined
namespace after all.
It's off-topic here since ISO C doesn't define NO_EXT_KEYS, but see
below... [...]
My question is: do recent MS C compilers or other common compilers
still define this macro too? I just know that GCC doesn't -- it
defines __STRICT_ANSI__ instead.
[...]
I took a look at my MSDN documentation and found that NO_EXT_KEYS was
defined only if /Za was specified, but for 16-bit versions of the MS
compiler cl. It's not clear in the doc but it appears that this macro
did'nt subsist anymore in 32-bit versions of cl.
That does seem to be the case. See http://support.microsoft.com/?kbid=65472
KB65472--"INFO: Predefined Identifiers in Microsoft C and C++". NO_EXT_KEYS
is in the "16-Bit Specific" section.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top