Path: utzoo!utgpu!attcan!uunet!husc6!uwvax!umn-d-ub!umn-cs!dayton!joe From: joe@dayton.UUCP (Joseph P. Larson) Newsgroups: comp.sys.amiga.tech Subject: Re: Manxifying Lattice Code Message-ID: <5715@dayton.UUCP> Date: 5 Aug 88 14:10:15 GMT References: <6711@well.UUCP: <386@stsci> Reply-To: joe@dayton.UUCP (Joseph P. Larson) Organization: Dayton-Hudson Dept. Store Co. Lines: 28 In article <386@stsci> berry@stsci.EDU (Jim Berry) writes: >From article <6711@well.UUCP:, by shf@well.UUCP (Stuart H. Ferguson): >: pplanet = (tplanet *) malloc (sizeof(tplanet)); >: >: but when it tries to store to the structure, it (sometimes!) crashes with >: Guru 3. The statement in question is: >How big is sizeof(tplanet)? Manx malloc() wants its argument to be a word, so >if it's bigger than 64K it won't work correctly. Also, Stuart mentioned he was compiling with +L. Doesn't that mean that Manx will use longs for ints rather than shorts? And if so, doesn't THAT mean that "sizeof(tplanet)" will be a long? So, the question is: what will malloc() do when you pass it a long and it wants a short? Just for safety, how about: pplant = (tplanet *) malloc((short)sizeof(tplanet)); That *should* take care of that. Question: does malloc() want a second argument being the type of memory you want? I don't have my manuals with me and always use AllocMem(). -Joe -- UUCP: rutgers!dayton!joe (Feed my Dayton Hudson Department Store Company ATT : (612) 375-3537 picture Joe Larson/MIS 1060 (standard disclaimer...) collection) 700 on the Mall Mpls, Mn. 55402