Hacker News new | ask | show | jobs
by KerrAvon 559 days ago
If you're implementing C23 compatibility, you could do

  auto p = (thing_t *)malloc(sizeof(thing_t));
and you get both DRY and avoid (void *) casting.
1 comments

> and you get both DRY and avoid (void *) casting.

While that line of code is DRY, it doesn't avoid casting "void *" to "thing_t *".