The following code, for instance, is very nonportable | What is the greatest fear of C DISC Styles? Other complex expressions, particularly those using the ternary? A function that writes on to variable-sized storage should take an argument maxsize that is the size of the destination |
---|---|
If it's given an array index, assert that it's within bounds | My aunt and I finally made it to the second floor of Nordstrom, and I immediately saw!!!! In general, global names including enums should have a common prefix identifying the module that they belong with |
Avoid unified headers Unified headers are generally bad, because they relieve the library developer of the responsibility to provide loosely-coupled modules clearly separated by their purpose and abstraction.
23When a non-prototyped version is needed, it is generated using an automatic conversion tool | Use assert everywhere your program would fail otherwise Write assertions to meaningfully crash your program before it does something stupid, like deleting data, or to prevent a security vulnerability, or just to prevent a segmentation fault |
---|---|
Arrays Use the concise syntax when you initialize arrays on the declaration line | The following code will clear only the three rightmost bits of an int on some 68000s |
This "outside" pointer may not be dereferenced.
18