Thread View: comp.std.c++
2 messages
2 total messages
Started by Tom Ngo
Thu, 18 Apr 1991 02:42
What is int &volatile r; [Was: What is int &const r;]
Author: Tom Ngo
Date: Thu, 18 Apr 1991 02:42
Date: Thu, 18 Apr 1991 02:42
20 lines
940 bytes
940 bytes
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
Re: What is int &volatile r; [Was: What is int &const r;]
Author: Mike Banahan
Date: Mon, 22 Apr 1991 18:48
Date: Mon, 22 Apr 1991 18:48
20 lines
1604 bytes
1604 bytes
... 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads