@usernameswift @MercurialBuilding @kirby you don’t need to cast any pointer to/from void pointers actually.
this is valid and generates no warnings with -Wall -Wpedantic -fanalyzer:
#include <stdio.h> #include <stdlib.h> struct nya { int foo; int bar; }; void nya(void *mew) { struct nya *meow = mew; printf("%d, %d\n", meow->foo, meow->bar); } int main() { struct nya foo = { .foo = 5, .bar = 10 }; nya(&foo); return 0; }so not only malloc, realloc, and free, void* in general are exempt from casts
(but do remember strict aliasing rules. you can’t put a type into a void pointer, and then turn it into another type)