Archive for the ‘stl’ Category

Traits of void resolved

Sunday, November 15th, 2009

It looks like I’ve got clarified status of the traits of void type. I posted my question to libstdc++ where Paolo Carlini kindly provided me what the bits I have been missing. Now, all the puzzles are in place:

[n1836], the specifications for the TR1 features mandates true for is_pod<void>, etc. Arguably this is a defect, which has been fixed in the ongoing work for the next standard, so-called C++0x.

The TR1 document in section 4.9 states:

8 It is unspecified under what circumstances, if any, is_pod::value evaluates to true, except that, for all types T:

is_pod<T>::value >=
   (is_scalar<T>::value || is_void<T>::value);

Given that, the bug report ID:458570 I submitted to Visual C++ 9.0 and it’s TR1 implementation on Microsoft Connect stays valid and according to what Stephan T. Lavavej confirmed in comments to my report, it’s been fixed in Visual C++ 10.0.

Paolo also added a note particularly important to programmers relying on C++ implementation by GCC compiler and libstdc++ library:

In general, we consider TR1 essentially frozen at this time and minimally maintained, consider that it was just an interim Technical Report

Here are references that are fundamental for the matter:

  • n1836 – Draft Technical Report on C++ Library Extensions
  • n2960 – Working Draft, Standard for Programming Language C++
  • Implementation of is_pod<T> and the rest of type traits by Boost.TypeTraits library.

Mission accomplished ;-)

Traits of void

Sunday, November 15th, 2009

Long time ago, I reported bug to Visual C++ 9.0 (Visual Studio 2008 SP1) complaining that has_trivial_destructor applied to void returns true (ID:458570). I also discussed it with folks on comp.std.c++ where, among quite different voices, Pete Becker writes:

[tr.meta.req]/8 in TR1 requires is_pod::value to be 1. n2857 is not a standard, and implementations of previous standards are not wrong for not doing what isn’t yet required of them.

and later concludes:

Under the current standard, using the name std::is_pod requires a diagnostic. So if you want to be literal, both compilers are “wrong”. Nevertheless, neither is really “wrong”, they just implement different non-standard versions of is_pod.

So, Visual C++ might actually not be wrong. Fair enough.

Today, I got back to this issue for a while a little extending my test program to use the type traits from both, TR1 and C++0x:

#include <iostream>
#include <tr1/type_traits>
int main()
{
using std::cout; using std::endl;
cout << std::tr1::is_pod<void>::value << endl;
cout << std::tr1::has_trivial_destructor<void>::value << endl;
cout << std::is_pod<void>::value << endl;
cout << std::has_trivial_destructor<void>::value << endl;
}

and compiled it with GCC 4.4.1:

$ g++ -Wall -pedantic -std=c++0x void.cpp
$ ./a.out
1
1
0
0

Now, my confusion has been raised to the power of 2. This is clearly a Polnische Wirtschaft or Czech movie or Turkish sermon

…let’s try to ask libstdc++ folks.

Iterators Must Go!

Tuesday, August 4th, 2009

I’ve already announced the brilliant and provocative presentation given by Andrei Alexandrescu titled Iterators Must Go!.

Here is video of Andrei’s keynote digged to boostcon.blip.tv:

It may seem this is a C++ oriented presentation, but in fact it’s more related to software design, design patterns and idioms, interface oriented design, programming by contract and…shortly, it’s really worthwhile to watch, during lunchtime of course ;-), and enjoy!

Sling the code, sling the sound

Friday, July 24th, 2009

C++ gurus can atomise not only particles of code but sound too ;-)

Andrei Alexandrescu’s hands like a pair of iterators are plotting new range of progress :-)

Oh no! Iterators must go!

std::basic_istream fixed in VC++ 9.0

Tuesday, January 29th, 2008

Stephan T. Lavavej from the Visual C++ Libraries Development Team confirmed that the bug I’ve reported recently about incorrect cast in the input operator implemented in the std::basic_istream class has been fixed. New corrected implementation is available in the C++ Standard Library shipped with latest version of the Visual C++ 9.0 compiler from the Visual Studio 2008.

A bug in std::basic_istream from Visual C++

Wednesday, January 23rd, 2008

Update: I submitted this problem to the Microsoft Connect and the Feedback ID is 323765

I believe I found a bug in Visual C++ implementation of the C++ Standard Library (AFAIR, it’s provided by Dinkumware,Ltd.). This is my first trove of that kind in Visual C++, thus I should exclaim Hurray! ;-). The C++ library discussed here is shipped with Visual C++ 8.0 compiler from the Visual Studio 2005 Professional.

Shortly, in the std::basic_istream class, implementation of input operator overloaded for unsigned long with Microsoft specific modifier __w64 consists of incorrect cast from reference to non-const to unsigned long, a nonreference type – rvalue.

(more…)

How to use STLport with eVC++

Sunday, December 25th, 2005

STLport LogoToday, I published my first article on the Pocket PC Developer Network.
My article is a kind of crash course explaining how to use STLport with eMbedded Visual C++ compiler and IDE to develop Windows CE applications. I hope it will encourage new Windows CE software developers to try STLport. I found this STL implemenation as a great piece of software, useful in my daily work and more complete STL implementation than that shipped with eVC++ SDKs.

If you are curious what I wrote follow this link to How to use STLport with eMbedded Visual C++.