Re:[boost] [serialization] non-conformance in collection_load_imp.hpp

Joaqu?n M? L?pez Mu?oz wrote:
"serialization/collections_load_imp.hpp" defines a private template class stack_allocate for stack-based reservation of uninitialized memory. To the best of my knowledge, the way it does so is not std-conformant due to alignment issues. Fortunately, (undocumented) "boost/aligned_storage.hpp" provides a template class named aligned_storage which handles the issue, so I guess the problem can be solved by just using this facility instead of stack_allocate.
This has been mentioned before. I was unable to find any information other than the code itself which wasn't all that transparent to me. And the stack allocate was soooooo simple. Is aligned_storage part of boost? Is it documented anywhere? Is it part of any test suite? Has it been tested for portability? In general I would prefer a boostified component over a homebrew one. I'm really not sure of what the status of aligned_storage is. Also, the nameitself didn't make it clear to me that its intended purpose was identical to that implemented by stack_allocate. Robert Ramey

On Fri, 5 Mar 2004 07:59:31 -0800, "Robert Ramey" <ramey@rrsd.com> wrote:
Joaqu?n M? L?pez Mu?oz wrote:
"serialization/collections_load_imp.hpp" defines a private template class stack_allocate for stack-based reservation of uninitialized memory. To the best of my knowledge, the way it does so is not std-conformant due to alignment issues. Fortunately, (undocumented) "boost/aligned_storage.hpp" provides a template class named aligned_storage which handles the issue, so I guess the problem can be solved by just using this facility instead of stack_allocate.
This has been mentioned before. I was unable to find any information other than the code itself which wasn't all that transparent to me. And the stack allocate was soooooo simple. Is aligned_storage part of boost? Is it documented anywhere? Is it part of any test suite? Has it been tested for portability? In general I would prefer a boostified component over a homebrew one. I'm really not sure of what the status of aligned_storage is. Also, the nameitself didn't make it clear to me that its intended purpose was identical to that implemented by stack_allocate.
It's a fully documented part of Boost type_traits, assuming you are just after a POD type with a certain alignment: ::boost::alignment_of<T>::value Identifies the alignment requirements of T. Actually returns a value that is only guaranteed to be a multiple of the actual alignment requirements of T. T must be a complete type. ::boost::type_with_alignment<Align>::type Attempts to find a built-in or POD type with an alignment that is a multiple of Align. Tom -- C++ FAQ: http://www.parashift.com/c++-faq-lite/ C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
participants (2)
-
Robert Ramey
-
Tom Widmer