Bregalad wrote:
With #defines you can do pretty much anything this style. I do not know whether that's what he did or not, though.
Yea, but this is actually part of the spec - though it looks like the C spec just has these as a bunch of #defines in a specific header file.
I'm not a big fan of #define though and pretty much never use it, otherwise you end up with things like this: (From the linked emu)
Code:
#define T tick()
#define G u16 a = m(); u8 p = rd(a) /* Fetch parameter */
template<Mode m> void ROL() { G; u8 c = P[C] ; P[C] = p & 0x80; T; upd_nz(wr(a, (p << 1) | c) ); }
At this point, you either assume G or T defined the "a", "p", "C", "P" variables, or that they are globals (like "P" and "C" are in this case - I guess capital letter = global is what they are going for?)
Also, you have P, p and C, c as variable names in the same function, and they mean completely different things.
I understand some people like writing this kind of code, but when you go this far to shorten syntax, reading the code starts to feel a bit more like deciphering, rather than just reading.