Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!zephyr.ens.tek.com!uw-beaver!ubc-cs!fornax!rsutc From: rsutc@fornax.UUCP (Rick Sutcliffe) Newsgroups: comp.lang.modula2 Subject: Re: MetCom (IT'S A WARNING!!!!) Summary: No, thats not quite right either Message-ID: <172@fornax.UUCP> Date: 13 Dec 89 18:18:09 GMT References: <"89-12-11-21:03:38.02*UK4H"@DKAUNI2.BITNET> Organization: School of Computing Science, SFU, Burnaby, B.C. Canada Lines: 21 In article <"89-12-11-21:03:38.02*UK4H"@DKAUNI2.BITNET>, UK4H@DKAUNI2.BITNET (JAE) writes: > Bob Campbell wrote: > > NEW is ALLOCATE(x,SIZE(x)) > > DISPOSE is DEALLOCATE(x,SIZE(x)) > THIS IS WRONG!!!! > Instead you have to write > ALLOCATE(x,SIZE(x^)); > DEALLOCATE(x,SIZE(x^)); Actually, its still not right. It is inadvisable to say the least to do SIZE(x^) before the ALLOCATE has been done. What if x is NIL? Do it this way: TYPE MyThingy = whatever; MyPoint = POINTER TO MyThingy; VAR x: MyPoint; ALLOCATE (x, SIZE (MyThingy)) Rick Sutcliffe