Synopsis: | Wherever possible, use sizeof entity; rather than sizeof (type); |
Language: | C |
Severity Level: | 6 |
Category: | EXPRESSIONS |
Description: |
If the type of value_ptr is changed, the preferred form takes account of this automatically. Note however that whereas sizeof (a local array) is the actual size of the
array, sizeof (a formal parameter denoting an array) is the size of the pointer, (to
which it is automatically converted).
Example: double *value_ptr; ... sizeof *value_ptr; /* Preferred to ... */ sizeof (double); /* this. */ |