Email or username:

Password:

Forgot your password?
Joshua Barretto

I'm not usually one to compliment C, but there is one thing it does better than pretty much all other mainstream languages: code density. It's an incredible language for code-golfing. Every few years I have a go at golfing a Brainfuck interpreter, and today I broke my personal record again.

3 comments
Joshua Barretto

#include <stdio.h>
c[1<<20],t[10000],*s[99];main(int x,char**a){fread(c,1,1<<20,fopen(*++a,"r"));char*i=c,*p=t;for(a=s;x=*i++;x==62?p++:x==60?p--:x==43?++*p:x==45?--*p:x==46?putchar(*p):x==44?*p=getc(0):x==93?i=--*--a:x==91?*p?*a++=i:({for(x=1;*i=='['?x++:*i==']'?x--:x;i++);}):0);}

Joshua Barretto

(admittedly this relies on GNU C extensions and smells of UB a little)

nadja

@jsbarretto Well I hope I will never have to review your C code :P

Go Up