Tuesday 1 July 2014

Fun with standards

This, as I understand it, is completely legitimate c99:

>$ cat main.c
#include <stdio.h>

inline void foo()
{
        printf("inline\n");
}

int main()
{
        foo();
        return 0;
}


>$ cat outline.c
#include <stdio.h>

void foo()
{
        printf("out-of-line\n");
}

>$ clang -O0 -c main.c -o main.o && clang -O0 -c outline.c -o outline.o && clang -o inline-test-O0 main.o outline.o
>$ clang -O2 -c main.c -o main.o && clang -O2 -c outline.c -o outline.o && clang -o inline-test-O2 main.o outline.o
>$ ./inline-test-O0
out-of-line
>$ ./inline-test-O2
inline

Wednesday 18 June 2014

Nice Languages Finish Last

I am writing things in Lua. Lua is a nice language, everybody keeps telling me so.

A very compelling use case for Lua is to use it as a scriptable configuration file. You can imagine how wonderful that would be:

Client wants to get configuration elements from the environment. They can already do that.

Client wants to get configuration from a different file with a weird proprietary format. They can already do that.

Client wants to use the most recent different file from a whole directory of them. They can already... Wait. They can't do that! They want to perhaps sleep for a bit and then check again. They can't do that either. You see Lua is a nice language and doesn't have a massive bloated API that can do everything. Python, Perl, or PHP could have done those things, because they are not nice.

They are useful.