Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!fxgrp!ljz From: ljz@fxgrp.uucp (Lloyd Zusman) Newsgroups: comp.lang.c Subject: Re: Optimization (was Re: volatile) Message-ID: <280@fxgrp.UUCP> Date: 23 Apr 88 07:12:39 GMT References: <13074@brl-adm.ARPA> Sender: news@fxgrp.UUCP Reply-To: ljz@fx.com (Lloyd Zusman) Organization: Master Byte Software, Los Gatos, California Lines: 48 In article <13074@brl-adm.ARPA> dsill@NSWC-OAS.arpa (Dave Sill) writes: >Terry Lambert writes: >>Basically, if it works without -O, it should work with -O, regardless of what >>the compiler writer's optimization does to achieve its goal. If this makes >>writing compilers harder, so what? > >This bears repeating. There should be no circumstances under which >the semantics of the language are changed by a flag to the compiler. > > ... Wholehearted agreement! This seems to imply ... 1) No optimizer for C should be considered as conforming to ANSI standards unless, in so many words "... if it works with -O, it should work with -O, ..." -or- 2) Something like 'volatile' must exist. Now, if the first option comes to pass, then 'volatile' is a moot point. Methinks this is rather unlikely. In the case of the second option, we still don't necessarily need 'volatile' as currently specified. Since the purpose of 'volatile' is to tell the compiler something it needs to know about how to handle its optimization, how about using #pragma volatile ... instead? This would satisfy those people who don't want the name space cluttered with new keywords and also those people who need to protect certain variables from over-zealous optimizers. The ANSI committee could specify that the 'volatile' #pragma option either does nothing (without generating an error) or else work as 'volatile' is now specified. Wouldn't this be more satisfactory than the current proposal? By the way, 'noalias' could be handled similarly. -- Lloyd Zusman Master Byte Software Los Gatos, California Internet: ljz@fxgrp.fx.com "We take things well in hand." UUCP: ...!ames!fxgrp!ljz