gmurray@ibmpcug.co.uk (G Murray) (04/21/91)
In article <5122672@janhh.hanse.de> jan@janhh.hanse.de (Jan Willamowius) writes: > It looks like Wirth is using different ways to allocate memory > in different versions of his books. Sometimes he uses > 'Allocate(Var,SIZE(Type)' and sometimes 'NEW(Var)'. > > I like the second way better, but my compiler only supports Allocate. > So, is there a way to write a NEW (and DISPOSE, of course) ?> [Code Deleted] > The problem is that p 'looses' its type in the conversion to ADDRESS and > only a WORD is Allocated (ADDRESS is POINTER TO WORD). I don't think that you will be able to do it. NEW and DISPOSE are normally built in functions, that require ALLOCATE and DEALLOCATE to be IMPORTed. In my experience the compiler normally translates calls to NEW and DISPOSE into appropriate calls to ALLOCATE and DEALLOCATE. So, without this 'inside information' available to the compiler, I don't think that a library function will be able to do it. Graham Murray email gmurray@ibmpcug.co.uk Senior Programmer gmurray@cix.compulink.co.uk Gravatom Technology Ltd voice +44 329 823986 -- Automatic Disclaimer: The views expressed above are those of the author alone and may not represent the views of the IBM PC User Group. --