Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!tut.cis.ohio-state.edu!ucbvax!pasteur!galileo.berkeley.edu!jbuck From: jbuck@galileo.berkeley.edu (Joe Buck) Newsgroups: comp.std.c++ Subject: Re: Responses to ~const 1.6: Possible generalizations of ~const Message-ID: <11647@pasteur.Berkeley.EDU> Date: 4 Mar 91 05:06:53 GMT References: <4198@lupine.NCD.COM> Sender: news@pasteur.Berkeley.EDU Reply-To: jbuck@galileo.berkeley.edu (Joe Buck) Distribution: comp Lines: 34 In article <4198@lupine.NCD.COM>, rfg@NCD.COM (Ron Guilmette) writes: |> In article ngo@tammy.harvard.edu (Tom Ngo) writes: |> + |> +Background information to this posting was in a very recent summary. |> + |> ... |> + ~volatile Do allow optimization on this object [even if the |> + enclosing object is declared volatile]. |> + |> +Joe Buck was against ~volatile on the |> +grounds that it would add virtually nothing to the language; it would |> +"give a tiny bit of useful information to an optimizing compiler, |> +[but] it would gain nothing in expressive capability." |> + |> +Joe Buck and Ron Guilmette felt that symmetry and |> +simplicity of implementation might be good reasons to permit a |> +~volatile specifier. Tom makes it look like I contradict myself. No, I meant that ~volatile doesn't get you much extra but you may as well throw it in to maintain a uniform grammar, since volatile may appear anywhere that const can at present. |> One could argue that ~volatile has very little usefulness, however the |> same could be said for `volatile' itself. Does that mean that we should |> get rid of `volatile'? I think not. There are places that volatile is needed, especially when interacting with hardware, signals, and interrupt service routines. The "pre-volatile" trick was putting in a comment saying "WARNING: don't use -O on this code". -- Joe Buck jbuck@galileo.berkeley.edu {uunet,ucbvax}!galileo.berkeley.edu!jbuck