Friday 1 July 2011

Semantic inline

Inline. In a multi-pass environment like you'd find in .NET or Java then there's no need and no purpose to inline as it exists in C++. However, I figured it can be used for another purpose- "semantic" inlining. In this case, we would make __FILE__, __LINE__ language calls like file() and line(). And, more importantly, alloca() would be inlined, meaning that you can allocate memory off the caller's stack in an inline function. Great for implementing, say, memory stacks :)

Of course, actual inlining would be best left to the compiler.

No comments:

Post a Comment