Best practices
C-compilers pretend to be free of errors and, yet, there is a continuous need to update the compiler. Ideally, when programming in C, the program should compile in such a way as to take advantage of the nuances of the underlying assembly language. However, as told by Keith Curtis of Microchip, a long-time consultant, “typically the errors [in C compilation] are not so much errors as they are inefficiencies.” He gives the following example. “Setting a bit in a register is typically done by reading the register, ORing on the bit, and then storing the value back into the register. However, PIC16Fxxxx parts all have a bit set instruction that allows you to set individual bits.” In other words, the compiler may not pick up ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access