Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!mips!spool.mu.edu!uwm.edu!ogicse!zephyr.ens.tek.com!vice!bobb From: bobb@vice.ICO.TEK.COM (Bob Beauchaine) Newsgroups: comp.lang.pascal Subject: Re: Type cast? Message-ID: <7429@vice.ICO.TEK.COM> Date: 9 May 91 19:52:41 GMT References: <26835@adm.brl.mil> Reply-To: bobb@vice.ICO.TEK.COM (Bob Beauchaine) Organization: Tektronix, Inc., Beaverton, OR. Lines: 29 In article <26835@adm.brl.mil> TOMJ@csdserver3.csd.scarolina.edu (Thomas E. Jenkins, Jr.) writes: > > GetMem works fine with or without a type cast. Both are right. I think >what should have been said is that Type cast ARE needed in the above >example, but are not required in turbo pascal with the GetMem procedure. >The following code works fine WITHOUT a type cast: > [code deleted] In defense of my original posting which started this debate, there is one very good reason for using type casts the way I did. I have precompiled (in unit form) graphing routines that don't know what kind of data to expect at run time. I allocate the memory with an untyped pointer, then use a typecast on the pointer to the array when the graphics are invoked according to an enumerated type passed into the procedure. This allows me to use all of the integer and IEEE real forms as array elements. Hence the solution that naturally came to mind. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ Bob Beauchaine bobb@vice.ICO.TEK.COM Heaven, n.: A place where the wicked cease from troubling you with talk of their own personal affairs, and the good listen with attention while you expound your own. Ambrose Bierce, "The Devil's Dictionary"