|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2002-08-20 15:59:53
From: "David B. Held" <dheld_at_[hidden]>
> Yes, I just verified that both gcc and Rogue Wave have basically the
> same implementation. I was under the impression that the preferred
> implementation involved sizeof(). What do I know?
Well, FWIW, you can't do that trick portably. There are EDG-based compilers
which will detect it and complain. Furthermore, you won't be able to use
offsetof() portably on a non-POD type.
> > [...]
> > Because convertions from char * to U * is unspecified. I simply forgot
> > to mention it. Sorry.
>
> Is that so? That seems like it would make the STL impossible, as it
> regularly allocates raw memory as char*, and casts it to the appropriate
> T* after construction. You're going to have to quote chapter and verse
> on this one.
I think that's a void*-to-T* conversion at work.
-----------------------------------------------------------
David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk