CompuServe Thread

#manx error message

6 messages in this thread
#6515From: reinhard kummerleAug 16, 1988 11:32 PM
why does the following line: pref=(struct Preferences *)malloc((unsigned)sizeof(struct Preferences)); give me a ptr/int conversion error in aztec 3.6 with pref global as struct Preferences *pref; thanks
#6535From: Steve AhlstromAug 17, 1988 1:03 AM
Your code is good. The most likely cause of the warning is that you forget to declare malloc. extern char *malloc();
#6700From: jack radiganAug 17, 1988 10:21 PM
Tack on a long to the unsigned for the size declaration too… -Jack-
#6716From: Steve AhlstromAug 17, 1988 11:56 PM
No need to. malloc() is a Manx call, not Intuition, it compiles cleanly without it.
#6734From: Michael St. LaurentAug 18, 1988 12:58 AM
The easiest way to get around this problem is to #include <functions.h> which contains the correct return values for all the functions. If you do not want to do this you should use extern VOID *malloc(); which will allow you to assign the pointer from malloc to any pointer variable. -msl-
#6870From: reinhard kummerleAug 18, 1988 4:09 PM
thank you michael and steve. yes the problem is fixed, i've been ignoring it for months, if you can believe that!