Code Readability

I wanted to start a thread to address an issue with code readability, but if anyone else has any good tips on writing very readable code we should write them here.

My question is if there’s a way to define a variable, like say #define SOMETHING some+complicated+combination+of+blocks+and+thread+idx

If I create a variable to hold a thread index, won’t that cause more registers to be used that if I had written the actual codes to compute the thread index?

Sometimes I’d like to outsource some complicated long string of variables into a single variable, so I can read my code, but I want to minimize the use of registers if at all possible.

Thanks,
Matt

The compiler is pretty smart these days about register allocation. I wouldn’t worry about adding new temporary variables if it improves your code’s readability.