Machine specific predefined names

Bakul Shah bvs at light.uucp
Thu Feb 18 05:53:59 AEST 1988


I have some questions, quibbles really, for the __STDC__ experts
on the net.  Please, definitive answers only!

Many C compilers predefine some names to indicate a subset of
{processor, os} {family, a specific member of that family}; some
such names are mc68k, mc68000, vax, unix, etc.

Now our local stdc expert says that an ANSII compatible compiler
can not use these names as they belong to the name space reserved
for the user.  Such a compiler may only predefine names that
belong to the name space reserved for the implementer, that is,
names matching the ``_[A-Z_][0-9A-Za-z_]*'' pattern.  He suggests
that ANSII C compilers for the AMD29000 processor predefine _Am29k
(for this family) and _Am29000 (for this specific processor).

Doing so is perfectly safe but _These _Names _Are _Hard
_To _Type.  Some of us prefer the simpler am29k and am29000.

So my questions are
1) Is our local expert right?
2) If so, will companies such as SUN, AT&T, DEC etc. predefine
   names such as _Sparc, _U3b2, _Vax in their ANSII C compilers?
   Note that doing so will also force change in some `existing
   practices'.

I also wonder about exactly where the user / implementer boundary
falls.  If the compiler vendor provides a system call library, is
it considered part of an implementation?  If so, will the system
calls have to be _Renamed?  This doesn't make sense to me.
Clearly, I am missing something here.

Thanks.

-- Bakul Shah (..!{ucbvax,sun}!amdcad!light!bvs)

PS:  Yes, I know the standard is not yet approved so there is no
     such thing as an ANSII compatible c compiler.  Perhaps I
     should've used dpANS tracking c compiler.

PPS: It would be neat if atleast the ANSII compilers were to
     follow a more regular predefine scheme, something like:

#define OS_TYPE                 unix
#define UNIX_TYPE               bsd4_3
#define MACHINE_TYPE            am29k
#define AM29K_TYPE              am29000
#define AM29000_VERSION         B

These are define hierarchies, starting with OS_TYPE and
MACHINE_TYPE, so that you can do things like

#if     OS_TYPE==<os>
# if    <OS>_TYPE==<os><version>
...
# endif
#endif

Once the standard is approved atleast some (and hopefully most)
system, software vendors will switch over to the standard
(meaning: make their c sources palatable to a conforming
compiler).  This would be a good time to do some simple cleanup.
But I am probably dreaming.
-- 
Bakul Shah

..!{ucbvax,sun}!amdcad!light!bvs



More information about the Comp.lang.c mailing list