Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!ut-sally!ut-ngp!dlnash From: dlnash@ut-ngp.UUCP Newsgroups: comp.lang.c Subject: Re: C and Floating Point Message-ID: <4981@ut-ngp.UUCP> Date: Fri, 10-Apr-87 11:26:57 EST Article-I.D.: ut-ngp.4981 Posted: Fri Apr 10 11:26:57 1987 Date-Received: Sat, 11-Apr-87 17:10:00 EST References: <15958@sun.uucp> <5716@brl-smoke.ARPA> <14680@cca.CCA.COM> <802@viper.UUCP> Organization: UTexas Computation Center, Austin, Texas Lines: 40 Keywords: C Fortran Floating Point Parenthases In article <802@viper.UUCP>, john@viper.UUCP (John Stanley) writes: > In article <4968@ut-ngp.UUCP> dlnash@ut-ngp.UUCP (Donald L. Nash) writes: > >I like the -Oe idea better that the #define OPT_EXPR idea. Making a #define > >directive affect the compiler is not a good idea, since someone else may be > >using OPT_EXPR (or almost whatever else you come up with) to mean something > >else. The -Oe idea makes the most sense to me. > > > > Don Nash > > > > Don, you're correct in saying that OPT_EXPR -could- have been used by > someone prior to the standard, but in using that as a disqualifier you're > ignoring the difference in scope. The -Oe declaration will effect the > entire module being compiled with that flag. Using a define allows you > to "define" it at some point in the program and then undefine it later. > > --- > John Stanley (john@viper.UUCP) You're right. I realized that after I posted the article. I thought about how this could be done, and after looking through H&S, 2nd edition, I came upon a possible answer. The Draft Proposed ANSI C has a new pre-processor directive, #pragma, for sending implementation dependent stuff to the compiler. How about somethine like "#pragma optexp" to turn expression optimizing on and "#pragma nooptexp" to turn it off? That way, you could bracket parts of your code which should or should not be optimized. For compatibility with current implementations, optexp could be the default. BTW, H&S, 2nd edition is great! I recommend it to anyone who needs a complete C reference manual. Don Nash, Recovering from foot-in-mouth disease.... UUCP: ...!{ihnp4, allegra, seismo!ut-sally}!ut-ngp!dlnash ARPA: dlnash@ngp.UTEXAS.EDU BITNET: CCEU001@UTADNX, DLNASH@UTADNX TEXNET: UTADNX::CCEU001, UTADNX::DLNASH