Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!ius2.cs.cmu.edu!edw From: edw@ius2.cs.cmu.edu (Eddie Wyatt) Newsgroups: comp.lang.c Subject: Re: Types Message-ID: <1173@ius2.cs.cmu.edu> Date: Fri, 22-May-87 10:16:43 EDT Article-I.D.: ius2.1173 Posted: Fri May 22 10:16:43 1987 Date-Received: Sat, 6-Jun-87 12:43:36 EDT References: <7264@brl-adm.ARPA> <734@sdchema.sdchem.UUCP>, <293@osupyr.UUCP> <533@l.cc.purdue.edu> Organization: Carnegie-Mellon University, CS/RI Lines: 92 In article <533@l.cc.purdue.edu>, cik@l.cc.purdue.edu (Herman Rubin) writes: > In article <8024@utzoo.UUCP>, henry@utzoo.UUCP (Henry Spencer) writes: > > But this sure doesn't sound like C, and C is what X3J11 is standardizing. > > Okay, let me stick to nasty problems with C. > > 1. Have the compiler substitute locations in -asm- statements. > Other than editing the assembler output, I do not believe there > is any way to insert asm statements which can be expected to > survive a change from one compiler to another. I have no idea what you are talking about. The asm statement allows you to insert assemble code into your C program, what is the problem you are having with this? > > 2. Require that the compiler honor, whenever possible, assignments > to registers. ^^^^^^^^ Is this really a problem? Maybe I've been luckly, but when I ask for a register I get it provided I haven't used them all yet. > > 3. Allow the programmer to force non-promotion of floating to double, > whenever the programmer feels there is a good reason to do this. > I know when there is no point in using double; the compiler cannot. > Also, on some machines, one cannot print out a floating number in hex. > (Okay, I can finagle it. But I had an occasion where this would have > been a problem. I edited the assembler code, as the easiest option.) But heres the problem - floatfunc(3.0), should 3.0 be pass as a float or a double? To complicate matters, say floatfunc is external. Function prototypes may take care of this though. How about this to solve your problem. typedef union { float fnum; int inum; } floatint; floatint num; num.fnum = 4.5; printf("%x\n",num.inum); which brings up - guess my bug: static void BBfwrite (val) float val; { write_out_msg_buffer((char *) &val,sizeof(float)); } The problem here is fixed now. > > 4. Allow floating point numbers to be given in hex. Try putting in > 2^-32 as a floating point or double constant. Why should one have to > risk computer roundoff when it is totally unnecessary? Some people have noted that this might be a niece feature, I forget what if any problems there are with this. > > 5. Require that the compiler honor parentheses. When I want a > subroutine to return (x - y - k*c) + f(y), I most emphatically do > not want the compiler to do the "obvious" rearrangement to combine > the two terms with y; this can be a major loss of accuracy. To set > a variable equal to the parenthetical expression is a significant > loss of time. What two terms with y? I hope my C compiler doesn't think y can be factor out of that expression to form (f-1)(y) :-). To address your real complaint, the ANSI standard plans on supporting parenthesis honoring through the use of the unary +. +(x - y) + y will be evaluated as it appears. If you don't like the unary + put it into a define statement say: #define HONOR(x) +(x) Please lets not get into a long philosophic debate over this we have seen it all before. If you don't like it, use another language. > -- > Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907 > Phone: (317)494-6054 > hrubin@l.cc.purdue.edu or pur-ee!stat-l!cik or hrubin@purccvm.bitnet -- Eddie Wyatt e-mail: edw@ius2.cs.cmu.edu