I recently got put on a new project that uses C++ at its core and came across this warning when using the 10.6 SDK (GCC 4.2):
The code is essentially:
I don't get the warning with the 10.4 SDK. According to the header this code is at least 7 years old. Was there some type of chance that the pointer could be NULL with an older compiler? I'm confused as to why this was written like so, and why even if it was NULL, they would still try to access it. Note that this code is inside a C++ method.
Code:
warning: the address of 'in' will always evaluate as 'true'
The code is essentially:
Code:
float *in[SIZE];
if (in)
memcpy(in, src, src_size);
else
{
for (int i=0; i<len; i++)
in[i] = dummyValue;
}
I don't get the warning with the 10.4 SDK. According to the header this code is at least 7 years old. Was there some type of chance that the pointer could be NULL with an older compiler? I'm confused as to why this was written like so, and why even if it was NULL, they would still try to access it. Note that this code is inside a C++ method.