Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!purdue!mentor.cc.purdue.edu!ags From: ags@mentor.cc.purdue.edu (Dave Seaman) Newsgroups: comp.lang.pascal Subject: Re: Strange... The Turbo Pascal NEW command Message-ID: <3534@mentor.cc.purdue.edu> Date: 1 Aug 89 14:54:39 GMT References: <845@dutrun.UUCP> Reply-To: ags@mentor.cc.purdue.edu (Dave Seaman) Organization: Purdue University Lines: 19 In article <845@dutrun.UUCP> winfave@dutrun.UUCP (A.Verbraeck) writes: >There's one thing about Turbo Pascal that I don't understand, >and that is the how the New procedure knows the size of the >block on the heap to be allocated. If you really want to do this, you should be using Modula-2 instead of Pascal. It has been a while since I looked at this, but the way I remember it is as follows. Modula-2 specifies that a call NEW(P) is translated into the system procedure ALLOCATE(P,n), where n is the size of the object to be allocated, and is determined by the compiler. ALLOCATE is imported from the SYSTEM module. The Pascal standard does not provide any implementation details for NEW. Therefore there is no guarantee that what you are asking is even possible in any given implementation, short of writing assembly code. There certainly is no portable way of doing it. -- Dave Seaman ags@seaman.cc.purdue.edu