This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[RFC] Implementing addressof for C++0x
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Cc: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Thu, 20 May 2010 12:08:24 +0200
- Subject: [RFC] Implementing addressof for C++0x
Hi,
among the support facilities required by C++0x there is:
//////////////////
20.9.9.1 addressof [specialized.addressof]
template <class T> T* addressof(T& r);
1 Returns: the actual address of the object or function referenced by r,
even in the presence of an
overloaded operator&.
Throws: nothing.
//////////////////
the only implementation I briefly skimmed, part of boost, involves an
ugly series of reinterpret_cast, which, by the way, I'm not even sure is
completely safe vs aliasing, in all the possible circumstances. Thus,
I'm wondering if we want a "builtin" facility in the C++ front-end for
this too, additionally to those strictly required for implementing
<type_traits>, or maybe we can put to use existing gcc extensions...
Again, directions / help welcome (at least this time the ABI is safe ;)
Thanks in advance,
Paolo.