From: utzoo!decvax!cca!gwyn@Brl@sri-unix Newsgroups: net.unix-wizards Title: Re: C extensions Article-I.D.: sri-unix.4069 Posted: Wed Oct 27 04:36:24 1982 Received: Thu Oct 28 03:07:56 1982 From: Doug Gwyn Date: 25 Oct 82 10:01:45-EDT (Mon) I quite agree that it is important to maintain the simplicity and cleanliness of the C language, and that the existing compilers often leave something to be desired. So far the nicest compiler I have used has been the Ritchie PDP-11 compiler. PCC seems to have a lot of bugs; I would LOVE to "accidentally" be mailed the latest Bell Labs version... There is a "Production Quality C Compiler" project but I haven't heard about it recently. Some aspects of C seem to be tied to the way the UNIX loader operates . Whitesmiths, Ltd. found it necessary to insist on initializing all extern data exactly once among all files, to keep the more usual flavor of loader happy. It would be possible to extend the language to support "read-only" (constant) initialized data; in order to avoid adding another keyword, perhaps syntax like the following could be used: static char *errmsg == "Oops, sorry about that!"; On systems supporting read-only data segments, that would be the way to implement this feature; on more puny systems, the data would just have to be writable (better do your debugging on non-puny systems!). This (if supported by the kernel) would obviate the need to kludge up "sharable strings" a la Berkeley. The C preprocessor is currently considered part of the language (as is the Standard I/O library), so it cannot be changed readily. The problem with separately compiling #include files, as well as initializing unions, is that there is no viable GENERAL way to do this; the #include may depend on context as well as affect the semantics of the source it is included into, and I believe that unambiguous union initialization would be pretty tricky in the general case (if not downright impossible). Clearly features that can only work sometimes should not be bundled into the language. The current way to make a variable sometimes in a register, sometimes not would be something like this: int foo; ... { register int rfoo = foo; ... /* use "rfoo" instead of "foo" here */ ... foo = rfoo; /* if you want to keep the value */ } ... which is admittedly pretty ugly. However, if you want the capability this is about as efficient as possible.