[TUHS] Subject: changes for modern -> v7 -> v6 -> v5

scj at yaccman.com scj at yaccman.com
Tue Aug 5 05:11:27 AEST 2014


>
> Incidentally, I would say that the use of conditional compilation
> is evidence that the code is NOT truly universal, but has to be
> specially adapted to various environments.
>

For the most part, I agree, but there are some exceptions.  For example,
bit fields in C/C++ are laid out using the byte ordering conventions of
the target machine.  This can make it nearly impossible to write low-level
code to drive, e.g., hardware or communication protocols without
conditional compilation.

Of course, you can always shift and mask.  The code becomes
incomprehensible, but identical for big- and little-endian.  For my money,
using bit fields leads to code that is clear and easy to debug, and the
obvious rationale of the conditional code makes it a winner.

Steve




More information about the TUHS mailing list