Playing With Pointers

"The habit of expression leads to the search for something to express."

Tag: C++

Faking Dependent Types in C++

It is possible to have some kind of dependent typing in C++ using templates. The "solution" isn't elegant or usable, but I found it mildly interesting so I'll try to explain it here. The C++ type system with templates is Turing complete, so that something like this can be done shouldn't be a surprise. The [...]

A Theoretically Correct C++ Compiler

I just realized that a C++ compiler can never be theoretically correct. This follows from the fact that C++ templates are Turing Complete (no, really) and the halting problem. We can never say for sure whether a template expression is indeed infinitely recursive or is just taking too long to "parse". Sweet, but disappointing.