Other Pitfalls
As you have seen so far, pitfalls can occur in the most unexpected places—for example, algorithms, translations from mathematical equations—and through common typos. What you have not yet seen are pitfalls generated by external influences to source files. This section looks at pitfalls that can occur because of the way in which character arrays are implemented by compilers, and the use of hardware addresses from source files.
Pitfalls with Character Arrays
This section presents pitfalls related to character arrays and the difference of interpretation of character arrays between C and C++. Consider the following statement:
// Does not compile in C++. char text[3] = "fit";
This statement attempts to reserve three bytes of memory ...
Get C++ Footprint and Performance Optimization now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.