VC8 type traits documentation

Peter Dimov asked, and I don't recall seeing an answer posted (back on May 5): "Where is the instrinsic support documented, BTW?" Here: http://msdn2.microsoft.com/library/ms177194(en-us,vs.80).aspx -cd

Peter Dimov asked, and I don't recall seeing an answer posted (back on May 5): "Where is the instrinsic support documented, BTW?"
Here:
http://msdn2.microsoft.com/library/ms177194(en-us,vs.80).aspx
Correct, I did post that URL at the time I believe, I also promised to update the type_traits documentation on intrinsic support, which can be found here: http://www.boost.org/regression-logs/cs-win32_metacomm/doc/html/boost_typetr... John.

John Maddock wrote:
Peter Dimov asked, and I don't recall seeing an answer posted (back on May 5): "Where is the instrinsic support documented, BTW?"
Here:
http://msdn2.microsoft.com/library/ms177194(en-us,vs.80).aspx
Correct, I did post that URL at the time I believe, I also promised to update the type_traits documentation on intrinsic support, which can be found here: http://www.boost.org/regression-logs/cs-win32_metacomm/doc/html/boost_typetr...
Thanks, John. I only just became aware of the type traits intrinsics in VC8 beta 2 and immediately my thoughts turned to Boost. In a quick search of the archive, I didn't see the URL, but I likely just simply missed it. -cd

It appears the support for compiler intrinsic type traits in Beta2 is implemented only partially: typedef int T; __is_pod(T); __has_trivial_constructor(T); __has_trivial_copy(T); __has_trivial_assign(T); __has_trivial_destructor(T); __has_nothrow_constructor(T); __has_nothrow_copy(T); __has_nothrow_assign(T); Ditto for the rest of fundamental types. All of the above return false, which AFAIK is incorrect! [§3.9, ¶10; §9, ¶4] struct A { A() {} A(const A&) {} const A& operator=(const A&) {} }; typedef A T; __is_pod(T); // false __has_trivial_constructor(T); // false __has_trivial_copy(T); // false __has_trivial_assign(T); // false __has_trivial_destructor(T); // true __has_nothrow_constructor(T); // false, too conservative __has_nothrow_copy(T); // false, too conservative __has_nothrow_assign(T); // false, too conservative The compiler is too conservative regarding nothrow, it should be able to deduce that constructor, copy and assign can never throw. struct B { B() throw() {} B(const B&) throw() {} const B& operator=(const B&) throw() {} }; typedef B T; __is_pod(T); // false __has_trivial_constructor(T); // false __has_trivial_copy(T); // false __has_trivial_assign(T); // false __has_trivial_destructor(T); // true __has_nothrow_constructor(T); // true __has_nothrow_copy(T); // true __has_nothrow_assign(T); // true It seems the compiler needs an explicit nothrow statement in order for ctor, copy and assign to be qualified as nothrow. Presumably the result of nothrow deduction is not fed to the intrinsics correctly in this version. Can someone comment on the above. Thanks, - NK
participants (3)
-
Carl Daniel
-
John Maddock
-
narechk