C standardization (linkers, #if, enums)
mrm at datagen.UUCP
mrm at datagen.UUCP
Wed Jul 18 00:29:15 AEST 1984
Regarding several of the news items:
1) Six character mono-case linkers. These are a fact of life on many
non-UNIX systems. In fact on RDOS (a Data General real-time OS),
the object module originally only allowed 5 characters, monocase,
since by using RAD50, 1 identifier would fit in 2 16-bit words.
Also, ADA will not necessarily spur OS-vendors into having linkers
that accept both cases without translation, since ADA is defined
as a mono-case language. Also, living with other languages (and
their object formats) is also a reality, that cannot be ignored.
I know people that routinely link C, FORTRAN, PL/1, and assembler
together. Finally, changing object formats is a b*tch, since
outside of UNIX, compilers produce object code directly (ie, every
compiler, linker, library editor, etc.) must be changed. I know,
we've been looking at changing object module formats at DG.
2) #if expressions: The new ANSI standard will add the use of
defined(name) in #if and #elif's. Also, #elif was added for else if.
While #ifdef and #ifndef are still allowed, #if defined(name) and
#if !defined(name) have more power, ie, you can use && and || on
them, so you could say:
#if defined(VMS) || defined(OS360)
....
#elif defined(UNIX)
....
#else
....
#endif
I don't remember whether __LINE__ and __FILE__ made it in, but I
seem to remember that they did.
3) What to do about enum's still divides the committe. Some favour
eliminating them (in favour of either #define or the new const
sub-type), others want to treat them as integer constants, and
still others want strict type-checking on them.
My own view is that there exists a need for them, and neither
alternative meets that need (you run out of stack space on many
compilers if you have more than 150 defines that are defined in
terms of the previous define, and const's in a typically implement-
ation would be initialized readonly variables, and hence could not
be used in case statements). Since #define's are typically not
known to the compiler, enum's (and const's) at least have a chance
of being exported to a symbolic debugger.
Michael Meissner
Data General Corporation
...{ ihpn4, rocky2, decvax!ittvax, allegra }!datagen!mrm
More information about the Comp.lang.c
mailing list