The Life of a Programmer

Archives

All of the things labelled as Posts, so that crawlers have a place to find them.

JavaScript and 3d graphics don’t mix

Writing WebGL code in JavaScript has been very frustrating. There are numerous aspects of the language which make this task harder than it should be.

Is exception safe code truly possible?

It is important to write exception-safe code. A truly exception-safe function produces no side-effects when an error occurs. It returns to the caller with the

The string type is broken

My previous article, “We don’t need a string type“, caused a bit of stir. Though the feedback is mixed, there is a common theme of

Are explicit namespaces required?

I’m working on modules in Leaf, implementing namespace support. The moment I write my first test a feeling of uneasiness sets in. As I stare

The true cost of zero cost exceptions

Exceptions are a cornerstone of programming. If we intend to use them prolifically, as in C++, we need an efficient implementation. Thus was born the

We don’t need a string type

Should string be a distinct type or merely an alias for an array of characters? I’m considering the options for Leaf and can’t convince myself

Safely using enable_shared_from_this

Obtaining a ‘shared_ptr’ from ‘this’ is possible using the ‘enable_shared_from_this’ class. It’s a feature that allows a class to reference itself within a smart pointer

Do we need the conditional ternary operator ?:

I’m reconsidering the necessity of the conditional ternary operator in Leaf. I’m having troubles coming up with a comfortable, flexible, and unambiguous syntax. The traditional

How to catch a “return” statement

Does ‘return’ always cause a function to return? Surprisingly the answer is “no”. Indeed there are situations in which ‘break’ may not always break from

1/2 Should Not Equal Zero

There’s something wrong when a language allows 1/2 to equal 0. It’s easy to understand why this happens, and perhaps it’s even easy to forgive

Leaf: Simple type conversions

One of the problems with C++ is the way it handles type conversion. It inherits a lot of implicit conversion from C and then adds