/*
//i comment this block, please see the updates
void* fun_one(char *buffer, long length)
{
if(NULL == buffer)
return xxx; //return what value here
...
}
fun_two()
{
...
fun_one(image->buffer, image->length);
...
}
*/
If the error happened, I do not hope to exit the program but return to fun_two()
. What should I do?
I know that return (void *)0;
or return NULL;
when succeed, but return what value when error?
links related: void *
update:
but what if ti's a thread function ,such as
int main()
{
...
pthread_create(&id1, NULL, (void*)myThread1, ¶m_struct);
...
}
void* myThread1(void* param)
{
struct len_str* img = (struct len_str*)param;
if(NULL == img->buf)
return xxx; //return what value here
if(0 == img->len)
return xxx;
...
}
links related: pthread_create
the return value of myThread1()
is void *
what value should return if the error occur