Hacker News new | ask | show | jobs
by kazinator 1085 days ago
Then again, if we are initializing something being declared, we have:

   T *p = malloc(sizeof (T));
or

   T *p = malloc(sizeof *p)
In the former, there is internal consistency with the repetition of T.

In the latter, repetition of p.

In the former, you're not going to change one T without the other, just like in the latter you won't change one p without the other.

Assignments give advantage to the latter:

   p = malloc(sizeof (T));  // no local redundancy linking parts together.