From mboxrd@z Thu Jan 1 00:00:00 1970 From: scj@yaccman.com (scj@yaccman.com) Date: Mon, 4 Aug 2014 12:11:27 -0700 Subject: [TUHS] Subject: changes for modern -> v7 -> v6 -> v5 In-Reply-To: <201408040356.s743u23Y008576@coolidge.cs.dartmouth.edu> References: <201408040356.s743u23Y008576@coolidge.cs.dartmouth.edu> Message-ID: > > 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