> if your function takes a t* and someone casts a random int to a t* and pass it in, it is gonna segfault.
True, that is not something a function ought to defend against.
However, the complaint was not about that, though, it was about not checking if the dataSize parameter is NULL.
I don't really have a problem with functions that segfault when given NULL pointer parameters as long as this is clearly documented!
Sometime, however, you just need to be familiar with enough projects in C that common-sense gets built. In the specified example:
unsigned char *LoadFileData(const char *fileName, int *dataSize);
I
expected that a function that returns an array needs to tell the caller how large that array is. This specific function is not one I would complain about.
These things are usually documented in the headers. In this case it says:
// Load file data as byte array (read)
So, yeah, it's pretty clear to me that the number of bytes has to be returned
somewhere, and there's only one parameter called `dataSize`, so this isn't something I consider to be a valid complaint.
[EDIT: Escaped pointers, and added last paragraph]