Here’s a very rough entry that I hope to refine a bit later.
Recently I’ve started writing things like:
str.find( pattern ) == str.npos // (*)
in.setstate( in.badbit ) ;
I’ll leave the latter for another post (or an expansion of this one). As to the former consider what the alternatives are:
str.find( pattern ) == std::string::npos
But what if the type of
strchanges, for instance to
std::wstring? You’d have to change the expression on the right, too (
nposhas the maximum value of the
size_type; implementations are *permitted* –not required– to assume that
std::size_tfor all allocators. Thus, in practice, it’s almost always
std::size_tbut there’s no guarantee.)
typedef std::string string_type ;
str.find( ... ) == string_type::npos
Note that if
stris actually a data member then you’d better have the typedef in the class.
str.find() >= str.size()
Well, I think that (*) is the best of all these alternatives.
Eventually they managed to do it:
export has been removed from C++0x.
When C++98 was being drafted, the EDG guys were among the opponents of this feature. In the end, it went into the standard and —just guess— EDG turned out to be the only company (ever) to implement it. The implementation work took them about three man-years (one year each —AFAIK William Miller, who is now part of the group, wasn’t there yet).
Then, when Microsoft hired H. Sutter and began to ship a compiler with some minimal consideration of the standard, a paper by H. Sutter himself was presented to the committee which explained to them why
export was just not affordable.
That was the very moment (early 2003, IIRC) when I gave up any hope to see
export anywhere else than in EDG’s front-end and Comeau C++.
By reading (quickly) some of Herb’s blog it seems that EDG has been explicitly asking for removal of the feature, at least as of late, but other sources seem to be on a different nuance. For instance, Michael Wong simply writes that (see his blog on IBM’s Rational Cafés) “even their [EDG’s] lead is not opposing its [of export] removal”. The differences might simply boil down to an evolution of their opinions… I don’t know and I haven’t verified the dates of the various posts. Or, as a reply on Herb’s blog itself seems to hint at, at differences between “the official EDG position” and e.g. what Daveed Vandevoorde might have expressed about export on the C++ newsgroups. Uh.
In any case, in the current Final Committee Draft for C++0x (n3092)
export has been removed.
It would be hard to convince me that there hasn’t been a lot of politics in all this.