3 ms·
On the contrary. you must cast it or get a warning in modern compilers (and an error if you compile it in C++ mode). The “don’t cast” consensus is about NULL r
by beagle3 7y ago
On the contrary. you must cast it or get a warning in modern compilers (and an error if you compile it in C++ mode).
The “don’t cast” consensus is about NULL remaining 0L and not of any pointer type (as was the case in some standard libraries in the early 90s)
Note also that the comma should be an asterisk.
- sherincall 7y agoI really doubt any compilers will warn on void* casts in pure C. Usually the warning is if you do: int *x; char *y = x; or similar. But if x was "void*", it really should work on all C compilers.
- fulafel 7y agoIt's fine in C and you won't get a warning (just try int *p = malloc(sizeof(int)) with gcc -Wall).