4 ms·
One of the very first IOCCC winners used the trick in 1984 (1984/anonymous): int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\ o, world!\n"
by lifthrasiir 5y ago
One of the very first IOCCC winners used the trick in 1984 (1984/anonymous):
int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}
- jakeva 5y agowhat does this program do? i compiled it and ran it and got no output. i hope i haven't fork bombed myself or something
- lifthrasiir 5y agoPrints "hello, world!", assuming sizeof(int) == sizeof(char*) (and the same alignments and ABI, etc).
- jfrunyon 5y agoI think this is equivalent to: int i; int main(){ for( ; i["]<i;++i){--i;}"]; // loop until i == 14? (the NUL byte on the end) read('-'-'-',i+++"hello, world!\n",'/'/'/') // read(0, <one byte of "hello, world!\n" at a time>, 1) ) {}; } int read(j,i,p){ write(j/p+p,i---j,i/i); // write(0/1+1, i-- - 0, 1) --> write(1, i, 1) --> write a byte to STDOUT }