7 ms·
C-- is like a lower-level, more primitive variant of C designed for code generation, hence its name. There aren't separate pointer types; everything is just bit
by trealira 3y ago
C-- is like a lower-level, more primitive variant of C designed for code generation, hence its name. There aren't separate pointer types; everything is just bitsN, where N is the number of bits in the integer or pointer. Tail recursion is explicitly requested by writing "jump fn(args)".
There's a computed goto, so you can build your own jumptables like this:
section "data" { align 4; jump_tab: bits32[] { L1, L2, L3 }; }
f (bits32 x) {
goto bits32[jump_tab + 4*x] targets L1, L2, L3;
L1: return (1);
L2: return (2);
L3: return (3);
}
This is a description of the language. I copied the above code from here.
https://www.cs.tufts.edu/~nr/c--/extern/man2.pdf https://www.cs.tufts.edu/~nr/c--/extern/man2.pdf