What features of C++ should be avoided in embedded systems?
Please classify the answer by reason such as:
If you're using an ARM7TDMI, avoid unaligned memory accesses at all costs.
The basic ARM7TDMI core does not have alignment checking, and will return rotated data when you do an unaligned read. Some implementations have additional circuitry for raising an ABORT
exception, but if you don't have one of those implementations, finding bugs due to unaligned accesses is very painful.
Example:
const char x[] = "ARM7TDMI";
unsigned int y = *reinterpret_cast(&x[3]);
printf("%c%c%c%c\n", y, y>>8, y>>16, y>>24);