On 05/28/2012 08:38 AM, Steven M. Schweda wrote: > I'm left wondering whether, say, "var = con1 << 31 << 1 | con0" offers > so great an improvement in clarity
It's not simply clarity (which is a matter of style). It's maintainability. For example, if a typo had been inadvertently put into the old 32-bit code (a misspelled identifier, say, due to someone typing a character by mistake), it would not have been caught by someone compiling on the 64-bit platform. But with the new code, compiling on one platform verifies the syntax on all platforms. This is an inherent advantage of "if (...)" over "#if ...", and it's an advantage we've come to appreciate over time. In this particular example, there's another maintainability advantage to the new code: it has one copy of the magic hexadecimal constants, not two. So testing on a 64-bit platform also helps to test that these constants are right on a 32-bit platform. The old code didn't have this property. > I've used a bundled C compiler on HP-UX, > which has been (intentionally) crippled to the extent of disabling the > "-O" option(s). As have I, but that's doesn't trump maintainability. For us, maintainability is more important than minor performance issues on obsolete or crippled systems.