Reputation: 1433
I have a very large code, that's why I can't post here all my code, can somebody explain what might be a problem if I have an error incompatible pointer type
and give me several ways to solve it, thanks in advance
just small clarification: I'm workin with pointers to functions
ptrLine createBasicLine(){
DECLARE_RESULT_ALLOCATE_AND_CHECK(ptrLine, Line);
result->callsHistory = listCreate(copyCall,destroyCall); <-here
result->messagesHistory = listCreate(copyMessage,destroyMessage); <-and here
result->linesFeature = NULL;
result->strNumber = NULL;
result->lastBill = 0;
result->lineType = MTM_REGULAR_LINE;
result->nCallTime = 0;
result->nMessages = 0;
result->rateForCalls = 0;
result->rateForMessage = 0;
return result;
}
copyCall,destroyCall - pointers to functions
/**
* Allocates a new List. The list starts empty.
*
* @param copyElement
* Function pointer to be used for copying elements into the list or when
* copying the list.
* @param freeElement
* Function pointer to be used for removing elements from the list
* @return
* NULL - if one of the parameters is NULL or allocations failed.
* A new List in case of success.
*/
List listCreate(CopyListElement copyElement, FreeListElement freeElement);
definitions of the functions
ptrCall (*createCall)() = createNumberContainer;
void (*destroyCall)(ptrCall) = destroyNumberContainer;
ptrCall (*copyCall)(ptrCall) = copyNumberContainer;
Upvotes: 0
Views: 76
Reputation: 6956
I should imagine that a pointer you are using is of an incompatible type for some context in which you are trying to use it.
Out of these, the last one may seem the most attractive, as it is likely to get you past the compiler pretty quickly. Sadly, it will probably make your code not work in strange and unpredictable ways.
Upvotes: 2