...
For example, C Library declares malloc()
as:
Code Block |
---|
void *malloc(size_t); |
...
further reduces the possibility of error:.
Code Block | ||
---|---|---|
| ||
widget *p; /* ... */ p = MALLOC(widget); /* OK */ if (p != NULL) { p->i = 0; /* OK */ p->d = 0.0; /* OK */ } |
...
reduces the chance of error in an allocation expression:.
Code Block | ||
---|---|---|
| ||
enum { N = 16 }; widget *p; /* ... */ p = MALLOC_ARRAY(N, widget); /* OK */ |
...