Clone wiki

cnippet / Home

Cnippet is a C compiler for code snippets. It completes declarations missing from an incomplete source-code and produces a compilable program.

Consider the file test.c, whose content is listed below.

void f()
{
    T pi = 3.14;
}

Now, suppose you try to compile it with gcc.

$ gcc -c test.c -o test.o

You should get an error similar to this one:

test.c:3:3: error: use of undeclared identifier 'T'
  T v = 3.14;
  ^
1 error generated.

But if you use cnippet (simply prefix the previous command)...

$ cnip gcc -c test.c -o test.o

It just works, test.o should be there!

Documentation

Updated