ngo@tammy.harvard.edu (Tom Ngo) (04/18/91)
I wrote: >Here's an interesting C++ statement. What does it mean? > int &const r; >Hopefully your answer is that it is illegal and/or meaningless. If Harald Fuchs replied: Fuchs> A reference is always constant, so "int&const r" is just a more Fuchs> verbose alternative to "int& r". Why bother with explicitly Fuchs> disallowing redundancies? OK, I can accept that. But what is "int &volatile r"? --Tom -- Tom Ngo ngo@harvard.harvard.edu 617/495-1768 lab number, leave message
mikeb@inset.UUCP (Mike Banahan) (04/23/91)
... what is "int & volatile .. " ... A good question to ask! A volatile reference to (exactly what doesn't matter) - if we were talking about C, and using a pointer, then it would mean that the value of the pointer was subject to unpredictable external change which cannot be discovered by simply reading the program; this is intended to allow for interrupts and concurrency to be implemented. Since a reference is not modifiable by the program (it's const), the utility of having a volatile one is severely questionable, but undoubtedly capable of implementation. One could imagine a globally-visible reference which is somehow updated by an interrupt routine to refer to various different objects at run-time. This makes me want to throw up, but that's what it mean by analogy with pointer types. If one of my guys did that with a reference, I daren't put in writing what I would want to do with him/her. Mike Banahan -- Mike Banahan, Founder Director, The Instruction Set Ltd. mikeb@inset.co.uk