Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rlgvax.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.lang.c Subject: Re: ANSI C suggestions Message-ID: <205@rlgvax.UUCP> Date: Thu, 18-Oct-84 18:02:30 EDT Article-I.D.: rlgvax.205 Posted: Thu Oct 18 18:02:30 1984 Date-Received: Sat, 20-Oct-84 06:49:18 EDT References: <228@boulder.UUCP> <4460@utzoo.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 42 > > (1) Get rid of that requirement that all floating point arithmetic > > be done in floating point. ... > > ... Note also that constants are still "double" unless explicitly cast > to "float", which is a nuisance (the alternative was nightmarish problems > in deciding the type of a floating-point constant). Not ideal, but workable. I presume the FORTRAN alternative (it's single precision unless specified with an exponent whose exponent character is 'd', not 'e', like "3.1415926535d0") was rejected for compatibility reasons; intuiting the type from the length of the string or somesuch is, I agree, nightmarish. The only alternative is to require it to be stated explicitly somehow; the question is whether the default should be "double" or "float". ("long" constants already require the length to be specified explicitly, by a trailing "L".) > > (2) The DEC C compiler allows a "readonly" designation on global > > variables. This is handy to insure that one does not overwrite > > static lookup tables and such. ... > > Again the committee is ahead of you. There is a "const" modifier in the > draft, taken from recent Bell-internal versions of C. It does more than > you suggest -- in my opinion, more than is really necessary -- but it can > be used to get this effect in particular. It is not just a convenience; > people who are putting tables into ROM for micros need it badly. And people who want to put tables or strings into shared code space, although there you can get away with them being in non-shared and writable data space. Currently, it's done with machine-dependent and implementation-dependent kludges, usually called "rofix" (for shoving everything into text space by turning ".data" into ".text" in the assembly output) or "yyfix" (for pushing YACC tables into text space). The latter changes with the System V YACC, as it depends on the exact shape of the generated "y.tab.c" to determine what are parse tables (to be put into one source file) and what is everything else (to be put into another source file). "const" is long overdue; I'm considering dropping it into our C compilers (although without the checking to catch attempts to modify constants at compile time). Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy