...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <cstddef> void* my_malloc(std::size_t nbytes) { void *ptr; // allocate storage from own pool and set ptr return ptr; } void* my_calloc(std::size_t nelems, std::size_t elsize) { void *ptr; /// allocate storage from own pool and set ptr return ptr; } void* my_realloc(void *ptr, std::size_t nbytes) { // reallocate storage from own pool and set ptr return ptr; } void my_free(void *ptr) { // return storage to own pool } |
Exceptions
DCL32-EX1: For compatibility with other compiler vendors or language standard modes, it is acceptable to create a macro identifier the same as a reserved identifier so long as the behavior is idempotent, as in this example:
Code Block | ||||
---|---|---|---|---|
| ||||
// Sometimes generated by configuration tools such as autoconf
#define const const |
Risk Assessment
Using reserved identifiers can lead to incorrect program operation.
...