C++

A group of items relating to the C++ programming language, standard, or the Boost C++ libraries.

Gnash under Clang

Gnash is now completely compilable and optimizable with the LLVM frontend Clang. The AGG renderer headers have one C++ bug that causes an error. This needs to be fixed externally if you want to use that renderer, as it seems legitimate for a compiler to reject it (even if GCC doesn't).

Clang has already helped to find a few bugs in Gnash. Some warnings picked up things that GCC missed. And most interestingly, there were cases where Gnash's behaviour was relying on the order of evaluating function arguments.

C++ ASCII literals

I didn't invent it! But as I can't find the original code, here is my own version. The idea was most likely inspired by the somewhat cleverer, but no more useful analogue literals.

Create your own ASCII art, drawing it directly in the source code. Can you think of anything more beautiful?!

#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>

struct AsciiLiteral
{
    AsciiLiteral() : n(false) {}

C++ facets

Facets are one of the least understood and most esoteric parts of the C++ standard library. Because they are rarely used, there are few code examples, which in turn means most people never encounter them.

This is a great shame! Facets are a fascinating and multifa rich source of coding fun!

Pointers and recursive templates

How do you get the 'pointed-to' type in C++?

template<typename T>
struct RemovePointer
{
    typedef T value_type;
};

template<typename T>
struct RemovePointer<T*>
{
    typedef typename RemovePointer<T>::value_type value_type;
};

What's the point? With a bit of boost magic, you can use pointers transparently in generic code:

Syndicate content