Path: utzoo!mnetor!uunet!husc6!rutgers!mtunx!mtune!codas!ateng!chip From: chip@ateng.UUCP (Chip Salzenberg) Newsgroups: comp.lang.c Subject: Re: Optimization (was Re: volatile) Message-ID: <258@ateng.UUCP> Date: 4 May 88 14:54:04 GMT References: <13074@brl-adm.ARPA> Reply-To: chip@ateng.UUCP (Chip Salzenberg) Organization: A T Engineering, Tampa, FL Lines: 29 In article <13074@brl-adm.ARPA> dsill@NSWC-OAS.arpa (Dave Sill) writes: >This bears repeating. There should be no circumstances under which >the semantics of the language are changed by a flag to the compiler. This statement is, in my opinion, usually true. However, the semantics of C are not as simple as Dave Sill seems to think they are. For example, Dave may consider: a = b; a = b; to mean "move data from b to a twice", which is what a simple C compiler might do. On the other hand, some people -- myself included -- consider that same C fragment to mean "assign b's value to a, then assign b's value to a", which is redundant and subject to optimization. Many people who complain about optimizers ass_u_me that they know what the output of the compiler should look like. They are not really writing C, they are writing for an assembler pre-processor which happens to accept C syntax. This method of programming is a Bad Thing, because it produces non-portable code. Aggressive optimizers, on the other hand, are a Good Thing. They allow programmers to write code which is fast _and_ portable. Putting up with "volatile" and other optimizer controls is a small price to pay. -- Chip Salzenberg "chip@ateng.UU.NET" or "codas!ateng!chip" A T Engineering My employer may or may not agree with me. "I must create a system or be enslaved by another man's." -- Blake