Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added MEM02-EX1 prefix for consistency

...

The use of type-generic function-like macros is an allowed exception (PRE00-EX4) to PRE00-C. Prefer inline or static functions to function-like macros.

Exception

MEM02-EX1: When compiling a 64-bit application on an LP64 or LLP64 platform, this recommendation should not be used because it is possible for the cast to hide a bug.  If stdlib.h is not properly included, the compiler will assume the declaration of malloc() to be int malloc().  When sizeof(int) on the platform is 4, the resulting pointer could be truncated due to the compiler assuming malloc() returns a 32-bit integer.  Additionally, casting the results of malloc() to a pointer on these platforms can also sign extend a negative 32-bit integer to an invalid pointer.

...