![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Warning: passing argument 3 of ‘pt_search_r’ from incompatible pointer typeint
pt_insert(struct pt_context *pt, struct tcp_connection *c) { struct pt_node *rn = NULL; u_char key1[KEY_BYTES], key2[KEY_BYTES]; int b; if (pt->head == NULL) { /* make a new head node */ pt->head = pt_new(MIN_KEY_BIT -1, NULL, NULL, c); if (pt->head == NULL) { perror("pt_insert(): malloc(): "); return (0); } else { /* increment node counter and return success */ pt->n++; return (1); } } else { memset(key1, NULL, KEY_BYTES); pt_make_key(key1, c); switch (pt_search_r(pt->head, key1, &*rn)) { case 0: memset(key2, NULL, KEY_BYTES); pt_make_key(key2, rn->con); /* find the first differing bit, and its value */ rn->bit = diff_bit(key1, key2, &b); ...2... if (((b ? rn->r : rn->l) == pt_new(MIN_KEY_BIT - 1, NULL, NULL, c)) == NULL) { return (0); } ..3.. if (((b ? rn->l : rn->r) == pt_new(MIN_KEY_BIT - 1, NULL, NULL, rn->con)) == NULL) { free(b ? rn->r : rn->l); return (0); } rn->con = NULL; pt->n += 2; return (1); case 1: return (2); } } return (0); } these three red line i am getting warning like this. 1. warning: passing argument 3 of ‘pt_search_r’ from incompatible pointer type 2.comparison between pointer and integer 3.comparison between pointer and integer how can i solve this problem? |
|||
|
#2
|
|||
|
|||
Re: warning: passing argument 3 of ‘pt_search_r’ from incompatible pointer typeQuote:
CPP / C++ / C Code:
You've got to be kidding, right? If the argument takes a pointer to pointer to pt_node and rn is a pointer to pt_node, then wouldn't you use &rn as the argument? I mean, really... Quote:
NULL is a pointer, not an integer. (Converting NULL to an integer may give a value of zero, but if you want to see if the value of an expression is equal zero, use zero, not NULL. Unlike the first message, I think that the second and third are not fatal, but the idea is to get rid of the warnings by using the proper notation. Regards, Dave Footnote: Since this is a continuation of your previous question (I assume it is the same program), the proper protocol is to continue on the same thread, not start at new one. Not a big deal, but think about it next time. |
|
#3
|
|||
|
|||
Re: Warning: passing argument 3 of ‘pt_search_r’ from incompatible pointer typeMany thanks for feedback.
Nasim |
Recent GIDBlog
Problems with the Navy (Enlisted) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| double concatenated dynamic list - different type assignment warning | dlp | C Programming Language | 11 | 01-Jun-2007 07:59 |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 13:12 |
| Pointer Usage in C++: Beginner to Advanced | varunhome | C++ Forum | 0 | 19-Aug-2005 09:25 |
| C++ PhoneBook | marita | C++ Forum | 46 | 12-Jun-2005 12:10 |
| [Tutorial] Pointers in C (Part II) | Stack Overflow | C Programming Language | 0 | 27-Apr-2005 17:36 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The