Recent blog entries for redi

Every time I type #include <utility> I wish there was a second C++ library header of utilities called <utilitu>, and another header of file utilities called <futility>.

20 Feb 2014 (updated 20 Feb 2014 at 09:46 UTC) »

To generate a PDF from the LaTeX sources for the C++ working draft:


git clone https://github.com/cplusplus/draft.git
cd draft/sources
latexmk -pdf std


On Fedora 20 I needed to install the following packages:


latexmk
texlive-isodate
texlive-relsize
texlive-fixme

chalst, ncm still posts here, unsyndicated, but infrequently.

I've been a bit more active recently, but don't rely on it being most months :) As I don't have much to say I don't see the point of setting up a dedicated blog site and syndicating it, Advogato's diary entries work for me.
ACCU 2014

Register now for ACCU 2014!

It's sad that Advogato's recentlog is now all but useless because of the frequency of embedded videos in people's posts, which bork the rest of the page.

New job

I started a new job at Red Hat today. After many years of contributing to libstdc++ as a volunteer I will now be working full-time on the GNU C++ library and runtime. I couldn't be happier to be working on a project I really care about and to be joining a great team of first class experts at Red Hat. I'm really excited about helping to provide an even better C++ implementation in GCC!
ACCU 2014 Call for Papers

Closing date is November 5th.
6 Sep 2013 (updated 6 Sep 2013 at 08:35 UTC) »

I wish people would stop syndicating blogs containing videos to advogato, it borks the html parser completely and makes the rest of the page unreadable.

If you work for a telecoms, networking or crypto company and have assisted the NSA by inserting backdoors or weakening crypto then I hope you are eaten alive by rats. Shame on you.

There should be an app for that pt. 92

Sometimes you install an app for your phone that works well and does what it says on the tin. At a later date you install an update which introduces some serious problem that turns your phone to a slow, creaking, unusable heap of crap (Roaming Angel from Orange, I'm looking at you) or simply removes all the useful functionality (I'm told this happened to First Direct banking on the go).

The app's "star rating" in the marketplace might appear average, but if you look in more detail you'll see the ratings are almost all polarised, giving either one or five stars. If you look into it in even more detail you'll see that the older reviews give it five stars but all the recent reviews give only one star. The app has rotted.

App stores should weight ratings so that every time the app is updated all older ratings have less weighting than ratings since the update. Another alternative would be to show a chart of ratings against time, so you can tell if the rating is dropping over time and see at a glance that the average rating dropped suddenly at a particular time.

But that wouldn't help existing users of the app, who are unlikely to go and check the popularity of apps they've already installed, and may not realise which app update made their phone slow to a crawl. Someone should write an app that tracks the rating of all your installed apps and warns you if any of them suddenly gets worse according to the reviews in the app store, so you can remove the rotten apps. The app should be called Rotten Apps (Rotten Apples is unlikely to get past the censors in Cupertino) or Approbrium. You're welcome. I'll accept royalties for this idea in cash or beer.

Hey, C++ programmers, stop writing Strict Weak Orderings by hand for your classes.

For two members it's manageable:

bool operator<(const Widget& l, const Widget& r)
{
if (l.x < r.x)
return true;
if (r.x < l.x)
return false;
return l.y < r.y;
}

But for three members it starts to get tricky:
bool operator<(const Widget& l, const Widget& r)
{
if (l.x < r.x)
return true;
if (r.x < l.x)
return false;
if (l.y < r.y)
return true;
if (r.y < l.y)
return false;
return l.z < r.z;
}

If you think that's not tricky, are you sure I got it right? Maybe I put in a deliberate mistake. Maybe it wasn't deliberate. Now consider that everyone who writes that does it slightly differently e.g.

bool operator<(const Widget& l, const Widget& r)
{
return l.x < r.x ? true : r.x < l.x ? false : l.y < r.y ? true : r.y < l.y ? false : l.z < r.z;
}

Or even:
bool operator<(const Widget& l, const Widget& r)
{
return l.x < r.x || (!(r.x < l.x) && (l.y < r.y || (!(r.y < l.y) && l.z < r.z)));
}

Now do that for ten members.

Stop right now and do this instead:
bool operator<(const Widget& l, const Widget& r)
{
return std::tie(l.x, l.y, l.z) < std::tie(r.x, r.y, r.z);
}

This creates a tuple of references and does a lexicographical comparison, so it just does the Right Thing. All you have to do is list the data members in the same order in each call to the tie function template, and even PHP programmers could do that.

If you haven't caught up with C++ 2011 yet you can use Boost's tuple, just #include <boost/tuple/tuple_comparison.hpp> and then use boost::tie instead of std::tie.

273 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!