C++14: Runtime-sized arrays

More details on the ISO C++ blog about runtime-sized arrays in C++14.

N3639 proposes to add local runtime-sized arrays with automatic storage duration to C++, for example:

void f(std::size_t n)
{
int a[n];
for (std::size_t i = 0; i < n; ++i)
{
a[i] = 2*i;
}
std::sort(a, a+n);
}

Traditionally, the array bound “n” had to be a constant expression.

2 Comments

Filed under C++, Programming

ISO C++ Spring 2013 Report

Herb Sutter has posted his trip report from the ISO C++ Spring 2013 meeting in Bristol.

The post includes details on features to be included in C++14, including:

  • std::make_unique – never use “new” again
  • Generic lambdas – allow auto for type name in lambdas
  • Dynamic arrays – stack-based arrays can take size parameter at runtime
  • std::optional – for variables that are ‘not set’ (like F# option)
  • Concepts lite – constraints for templates

Leave a comment

Filed under C++, Programming

Google task monitoring plans

The Register reports on Google’s approach to active task monitoring and management:

“Our solution, CPI2, uses cycles-per-instruction (CPI) data obtained by hardware performance counters to identify problems, select the likely perpetrators, and then optionally throttle them so that the victims can return to their expected behavior. It automatically learns normal and anomalous behaviors by aggregating data from multiple tasks in the same job.”

The article talks about the benefits in terms of low-latency guarantees, because hungry batch jobs can be killed. The data might be useful for tracking down performance bottlenecks too – imagine never having to attach a profiler to a running process because you can already attribute the time spent on a job to its individual tasklets.

Leave a comment

Filed under Technology

The Mythical Man-Month

The Guardian cites The Mythical Man-Month as mandatory reading for anyone planning a big software project. I’d agree, as well as recommending Peopleware (Tom DeMarco & Tim Lister) and Slack (Tom DeMarco)

1 Comment

Filed under Programming

Algorithm to sharpen grainy photos

This sounds too good to be true – using a huge database of photos to teach an algorithm how to make a photo look more natural.

Unlike other photo enhancement tools, which work on an image-by-image basis, Geisler’s approach—called “image processing with natural scene statistics”—is based on the analysis of thousands of images. Geisler and his team measured the statistical properties of those images and created an algorithm that determines what is or is not “noise” in any given photograph.

Leave a comment

Filed under Technology

F# Software Foundation

The F# community has founded a new organisation to promote the use of F# – FSSF

The mission of the F# Software Foundation is to promote, protect, and advance the F# programming language, and to support and facilitate the growth of a diverse and international community of F# programmers.

1 Comment

Filed under Programming

Book Review: The Business, Iain Banks

20130418-194820.jpgThis is the first Iain Banks novel I’ve read for years, mainly because the recent ones struck me as macabre, if not gruesome. This one doesn’t fall into that category though and was a fun read – I’d forgotten just how funny Iain Banks can be. The book includes his typical gritty scenes from Scotland as well as colourful scenes (and stereotypes) from America. Having read books by this author before, I wasn’t expecting the plot to be fully resolved at the end, and it wasn’t (I would have rated the book more highly if there had been more content about the intriguing double-cross that the main character discovered).

20130418-194521.jpg

1 Comment

Filed under Book Review

Book Review: The Common Lawyer, Mark Gimenez

20130418-192328.jpgI read The Common Lawyer after having read Accused by the same author. I really enjoyed Accused, so was really looking forward to this one – but ultimately I was disappointed. One of the elements I expected was there – detailed scene setting, leaving the reader with a vivid mental picture of the streets in Austin where the book is set. But I didn’t have much sympathy with the young lawyer character and overall I thought the plot was a bit thin, with needless murders sprinkled throughout to spice up the action.

20130418-193203.jpg

1 Comment

Filed under Book Review

Herb Sutter – complex initialisation for a const variable

Herb Sutter provided this handy use of lambdas to initialise a const variable that needs some logic:

const int i = [&]{

    int i = some_default_value;

    if(someConditionIstrue)
    {
        Do some operations and calculate the value of i;
        i = some calculated value;
    }

    return i;

} (); // note: () invokes the lambda!

It requires that the compiler can determine the type of the lambda even though it isn’t a simple return – that’s due to be finalised in C++14 but is supported in some compilers already.

Leave a comment

Filed under C++, C++ Code, Programming

How to survive a ground-up re-write

Great war stories from a guy who’s seen a number of re-writes.

<Fortunately, there's a very simple test to determine if you're falling prey to the False Incrementalism: if after each increment, an Important Person were to ask your team to drop the project right at that moment, would the business have seen some value? That is the gold standard.

Leave a comment

Filed under Programming