This is the mail archive of the gcc@gcc.gnu.org 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: [RFC] Implementing addressof for C++0x


Hi,
>>> ... for reference, it would be something like this (in my
>>> recollections,
>>> it was even uglier ;)
>>>
>>> template<typename _Tp>
>>>   _Tp*
>>>   addressof(_Tp& __v)
>>>   {
>>>     return reinterpret_cast<_Tp*>
>>>       (&const_cast<char&>(reinterpret_cast<const volatile
>>> char&>(__v)));
>>>   }
> It's uglier because the code above doesn't work for functions,
Ah, ok, it will be a little bigger then, I missed testing functions,
thanks. I will post the complete patch, in case.
> and because of compiler bugs.
Luckily we don't need that.
> Any kind of acknowledgment is fine with me, including none at all.
> Whichever you prefer. :-)
You are very kind, thanks. After all, we should still be below, say, 20
lines of code, thus, if you are ok with that, we are not going to need a
Copyright assignment, etc.

Paolo.


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