Shachar Shemesh <[EMAIL PROTECTED]> writes: > Oleg Goldshmidt wrote: > > >Hi Shachar, > > > >Compilers generate const temporaries to prevent accidental passing of > >such a temporary to a function that would be able to modify its > >argument. If that were allowed the programmer would be surprized > >because only the compiler-generated temporary would be modified, not > > the actual argument they thought they were passing. > > Please read my latest email on this thread. If you still stand by your > email, I'll answer it, as I think it misses the point by a far fetch.
First, I'll admit that I had not read your last mail (I presume the one with a rather involved discourse on auto_ptrs) when I responded to the original one. I stand by my posting so far. I *think* (and I may be wrong here, I have not had time to really study it in detail) that it says, in effect, the same thing as your last one. If you are creating explicit temporaries yourself, feel free to make them const, non-const, whatever. In your case, though, temp was created by the compiler, and the compiler justifiably thinks that you have absolutely no reason to modify it. You should not be aware of its existence (you are, since you know quite a bit about how compilers work, but that changes nothing). What I did not understand in your last posting is the statement that temps are "a mix" of const and non-const. If I trust my knowledge and understanding, they are const. -- Oleg Goldshmidt | [EMAIL PROTECTED] | http://www.goldshmidt.org ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
