Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error while compilation

Status
Not open for further replies.

sab1234

Programmer
Sep 29, 2003
11
0
0
US
Hi,

I am compiling some C codes in HP-UX11.i. I am getting the following warning message:

vatxdr_svc.c:81: warning: assignment makes pointer from integer without a cast

for the code:

transp = svctcp_create(sock, 0, 0);
transpHandle = transp;


Can anyone please help me out in this problem.

Thanks,
Andy


 
Have you a problem? That is a question.
It was a common practice in old C/Unix programming to mix int/pointer values w/o cast and to declare functions w/o return value type specs (int assumed).
Indeed svctcp_create() (from svc_soc.h) returns a pointer. Probably your transpHandle var has ptr type too. However no this func declaration in your code or there is incomplete dcl in old style like:
Code:
svctcp_create();
As usually int to ptr assignment works fine. If so, your compiler warns about potential danger but the code will work. You may suppress the warning with:
Code:
transpHandle = (void*)svctcp_create(sock,0,0);
But more better to verify why this module doesn't include appropriate header file. May be it's not an old (and bad) style case but the true platform-dependent problem.
 
You should include a header file with the prototype for your function. With no prototype, the return value of functions defaults to int, and you are trying to store the int returned by your function in a pointer variable.

The header to include could be:
Code:
#include<rpc/rpc.h>

--------------------
&quot;When all else has failed, read the manuals.&quot;

Denis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top