Article View: comp.os.os2.programmer
Article #1222RE:C Set/2 Question in malloc
From: "Martin Lansche"
Date: Fri, 28 Aug 1992 16:44
Date: Fri, 28 Aug 1992 16:44
27 lines
1249 bytes
1249 bytes
Uma, I saw your append in the comp.os.os2.programmer forum. I believe that I can help. C Set/2 is an ANSI compliant "C" compiler. Sun's compiler is K&R "C". The ANSI definition for malloc is: void * malloc(size_t); While the K&R definition is: char * malloc(); K&R compilers will not complain about implicit casts between potentially different sized pointers. ANSI compilers do. To explain the messages - (12,15) gives the line number (12) and the column number (15) containing the operation that is illegal. - (12,10) says the the operand is at column 10 - and (12,17) says the 2nd operand is at column 17 All of this is supposed to help you determine exactly where the error is and to what the messages are referring. To fix the problem, add a cast to the malloc, i.e. array= (long *) malloc(50*sizeof(long); Cheers, Martin Lansche lansche@torolab6.vnet.ibm.com
Technical Details
Message-ID:
<9208281644.AA10538@ucbvax.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!ucbvax!TOROLAB6.VNET.IBM.COM!LANSCHEShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!ucbvax!TOROLAB6.VNET.IBM.COM!LANSCHE
From: LANSCHE@TOROLAB6.VNET.IBM.COM ("Martin Lansche")
Newsgroups: comp.os.os2.programmer
Subject: RE:C Set/2 Question in malloc
Message-ID: <9208281644.AA10538@ucbvax.Berkeley.EDU>
Date: 28 Aug 92 16:44:05 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 27