Pythran: A Python subset to C++ compiler that takes advantage of SIMD

Pythran is a Python to c++ compiler for a subset of the Python language, with a focus on scientific computing. It takes a Python module annotated with a few interface description and turns it into a native python module with the same interface, but (hopefully) faster.

It is meant to efficiently compile scientific programs, and takes advantage of multi-cores and SIMD instruction units.

Pythran development is currently done using Python version 2.7.

https://github.com/serge-sans-paille/pythran

Using Lua with C++ in practice

There are many reasons to use Lua with C++. One of them is that you can put some of the logic from C++ code into scripts, so you can easily change them without the need or recompilation. You can also write some good interfaces, so the scripts are easy enough for even non-coders to write them. Lua is free, Lua is fast, Lua is used in game development quite often.

While there are plenty of good articles about using Lua with C++, I think there are not enough articles about how to use Lua in real projects.

This article is one of the many articles I plan to write. Here are some topics which my articles will cover:

  •  Entity creation and other basic stuff (you’re reading this now)
  •  How to implement entity creation
  •  Managing Lua state and cleaning up
  •  Scriptable state machines
  •  Events and callbacks…

https://eliasdaler.wordpress.com/2015/08/10/using-lua-and-cpp-in-practice/
https://eliasdaler.wordpress.com/2015/09/08/using-lua-with-cpp-in-practice-part-2/
https://eliasdaler.wordpress.com/2015/11/12/using-lua-with-cpp-in-practice-part-3/

Lambda-Over-Lambda in C++14

Modern C++, as defined in the C++11 standard has evolved to become  analgorithmic language. This represents as much an idiomatic departure from Object Orientation as C++ was a departure from C’s procedural top-down composition. “C++11 feels like a new language,” says Bjarne Stroustrup [Stroustrup]. The primary focus of modern C++ has become algorithms and generic programming. To this end, the language absorbs a number of idioms from other languages and paradigms, ranging from functional to meta programming concepts. Incidentally this is also the realm in which a much older language has done exceedingly well — since the 1950s: Lisp. Lisp is not only the first implementation of the Lambda Calculus but its entire structure is optimised to make generic programming easier. This paper will explore how the high level approach to developing programs in C++ is increasingly shaped by some of the same forces that dominate in developing programs using Lisp.

https://chriskohlhepp.wordpress.com/convergence-of-modern-cplusplus-and-lisp/
https://chriskohlhepp.wordpress.com/lambda-over-lambda-in-cplusplus14/

An overview on smart pointers

“My last blog post in 2013 was about the pointer in C++, and how most of its daily usages in C++ is now being replaced by classes replacing or managing the pointer. The last case, the RAII like objects called smart pointers is the topic of this post. I want to give an overview over the choices one can make when using smart pointers.

As I studied last year boost, Qt and wxWidgets closer, I saw, that all of them have their own implementations of smart pointers. Also, C++11 brings its own set of two classes of smart pointers. So, with C++11, smart pointers have arrived in the standard, and everyone using C++11 automaticly has 2 different good options for managing memory allocated with new…”

https://meetingcpp.com/index.php/br/items/an-overview-on-smart-pointers.html

Python-like Enumeration in C++11

“Range-based for loops in C++11 are a nice addition to the language. However, there is still no support in the STL for enumerating items in a container without creating an extra counter variable that must be incremented separately from the looping variable:

std::list<int> list = { 1, 2, 3, 4, 5, 6, 7 };

int index = 0;  // this is outside the loop block although only used inside it
for (auto x : list)
{
    cout << index << " " << x << endl;
    index ++;  // this has to be incremented manually; error-prone in more complex loop logic
}

Note that the index is not to access the items in the container; it is to keep track of how many items have been processed so far in the loop.

I would like to be able to enumerate items in an STL container as simply as it can be done in Python, i.e. via a generic “enumerate()“:

# Python code: 
list = { "a", "b", "c", "d", "e", "f" }

for index, x in enumerate(list):
    print(index, x)

In C++11, it could look like this:

std::list<int> list = { 1, 2, 3, 4, 5, 6, 7 };

for (auto x : enumerate(list))
    cout << x.index << " " << x.value << endl;

This is concise and clear. The next section provides some background. The main section shows the code that supports the above syntax and more. Finally, some possible extensions…”

http://www.codeproject.com/Tips/1029941/Python-like-Enumeration-in-Cplusplus

IncludeOS – Run your C++ code directly on virtual hardware

IncludeOS aims to be the thinnest, lightest possible layer, between your C++ code and virtual hardware. We provde a bootloader, standard libraries, lots (we hope) of modules, and the build- and deployment system. You provide the service.

IncludeOS is designed for KVM/Linux but previous versions have also been tested successfully on VirtualBox (which again runs on OS X Windows and Linux) and Bochs…

http://www.includeos.org/

What is a core dump and how do you parse one? (backtrace.io)

“A core represents a the state of a process at a point in time. It contains all the information that an engineer needs in order to inspect the process and its state even after the process has exited. This information includes thread information, mapped memory, register state and more. By using a debugger with the core file, engineers can interact with and inspect the state of the process as if they had attached a debugger to the process at the time when the core file was generated.

Ever wonder what exactly is contained in a core dump and how debuggers interact with them? This post is for you. We will explore how cores are generated and how software interacts with them…”

http://backtrace.io/blog/blog/2015/10/03/whats-a-coredump/

Higher Order Macros in C++

“C++ is a pretty powerful language for defining abstractions which let you get rid of redundancy. Functions and methods address duplicate chunks of imperative code. Base classes let you reuse data definitions. Templates let you do… well… almost anything.

Even so, there’s still often hunks of repetition that you can’t seem to eliminate. For example, let’s say we’re working with a language’s syntax. Typically, the parser generates an AST which then gets passed to the compiler. The compiler walks the AST using Ye Olde Visitor Patterne and generates some lower-level representation for it.

Depending on how rich your language is, you’ll have quite a few different AST classes to represent the different syntactic elements: literals, unary operators, infix expressions, statements, flow control, definitions, etc. V8, for example, has 40 classes to cover everything you can express in JavaScript…”

http://journal.stuffwithstuff.com/2012/01/24/higher-order-macros-in-c/

Recovering Live Data with GDB

“I recently ran into a problem where long-running program output was trapped in a C FILE buffer. The program had been running for two days straight printing its results, but the last few kilobytes of output were missing. It wouldn’t output these last bytes until the program completed its day-long (or worse!) cleanup operation and exited. This is easy to fix — and, honestly, the cleanup step was unnecessary anyway — but I didn’t want to start all over and wait two more days to recompute the result.

Here’s a minimal example of the situation. The first loop represents the long-running computation and the infinite loop represents a cleanup job that will never complete…”

http://nullprogram.com/blog/2015/09/15/