Robert Meek wrote: > This question may have come up before, but right now I have a > particular need to know the answer.
What sorts of things did your favorite search engine find? :) > I have a situation/procedure on a form in a project where quite a > lot of data of different basic types needs to be temporarily stored, like > one would do with the Windows clipboard. In another procedure on the same > form this data must be read and used. So in past versions I had always > created an Object and used it dynamically when ever these procedures were > required. This time I decided to use a simple record type, as really all I > need to do with it is hold data, field definitions are quite adequate. I > was wondering however which method is less resource intensive over-all, OK. Begin by defining "resource"; what things are you concerned about? > and > would normally assume the record to be so except that I've been fooled into > assumptions like that before! The variable I use for this record of TMyrec > is global to the unit only, but still I make sure all fields are completely > empty, nul, or zero as the case may be in-between uses. Is there yet a > "cheaper" method to handling a situation like this, or perhaps a better > method of using the record or object so as to reduce its overall cost to the > system? When you want the cost to be cheaper, what's the unit of currency? Dynamic memory, static memory, CPU instructions, time spent by the programmer to implement and test something? Given a record and a class, with declarations identical aside from the use of "record" versus "class" to declare the type, the class will be exactly four bytes larger than the record. It has a hidden field for storing its VMT pointer. The compiler will also store the class's VMT data somewhere in memory so that VMT pointer can point there. (All instances of the class will point to that same memory.) -- Rob _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

