This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Volatile MEMs in statement expressions and functions inlined as trees

Linus Torvalds <> writes:

| On 16 Dec 2001, Gabriel Dos Reis wrote:
| >
| > No, you're on the wrong page.  That specific example is given in a
| > specific context to disprove a specific (bogus) claim you made.
| Ehh.. You posted that (again) in response to
| 	| If you override the assignment operator, then the rules of  assignment are
| 	| defined by _you_, not by the C++ standard.
| and that is certainly not a bogus claim. 

You stripped out the context.  Here it is:

  | If you override the assignment operator, then the rules of assignment are
  | defined by _you_, not by the C++ standard. 

  The implicitly generated copy and assignment operator is defined by
  the C++ standard.  Again consider:

	  struct X { };

	  int main()
	    X x;
	    X() = x;
	    return 0;

| You gave it as an example of
| something completely different, namely the implicit copy-assignment
| operator, which was not even under discussion.

Not at all.

I gave it to show two things:
   1) rvalues of class-type are "addressable";
   2) to disprove your unfonded claim that lvalues are always on the
      left and rvalues on the right of assignment.

| And which, as I've pointed out, doesn't even _cover_ "volatile"
| assignments. Exactly because "volatile" is always a property of an object
| or function,

In the same way "const" is the property of the object, not of a class
-- the nonsense is to try to speak of cvs-qualified class.

| > | There are no implicit volatile assignment operators, because there are no
| > | volatile classes.
| >
| > That is nonsense.
| No.
| If there were a notion of a "volatile class X", then your example would be
| valid.

The point here is that your line of reasoning is bogus: there is no
notion of "const class X" and yet there is an assignment taking a
"const X&".  Trying to reason along the line that "a notion of 
'cv-qualified class X' is a preresite for existence of X::operator=(cv
X&) is just plain bogus".  That is why I pointed you to 12.8/10.


| And yes, I've read your precious "12.8.10". MY point, which you obviously
| missed, is that if the "volatile" _could_ be part of the definition of the
| class X, then the implicit assignment operator
| 	X& X::operator={const X&}
| _would_ have relevance to the problem of volatile assignments (because the
| "volatile" would be part of the definition of the class X itself).

I didn't miss that bogus reasoning.  It is precisely that bogus
reasoning I'm arguing with.  cv-qualification is never part of the
definition of a class, and yet we have assignment operator taking a
cv-qualified reference.

| See my argument?

I saw, it was bogus and now we've strenghten its "bogusness".

| In short, class assignments, _whether_ explicit or implicit, do not have
| any relevance.

Its relevance here is to show you that rvalue in C++ is not what you
think it is.  I didn't claim that objet of class-type assignment
explains the re-load.  Please don't put words in my mouth. I gave that
example to disprove specific unfonded claims you made.   

-- Gaby
CodeSourcery, LLC             

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]