[comp.windows.ms] Pass a Handle or Address

al@well.sf.ca.us (Alfred Fontes) (09/16/90)

I'm designing a system that will be implemented in C++, although this 
question is probably language-independent.  At various points in the 
program, a method gets an object or structure passed to it (actually, 
for efficiency, a reference is used).  In many situations, passing an 
object's memory seems more appropriate than passing its address. 

Do any of you experts out there have any ideas about this?  When is it 
better to pass a handle, and when is it better to pass an address? 

pdavid@polyslo.CalPoly.EDU (Paul C. David) (09/17/90)

al@well.sf.ca.us (Alfred Fontes) would have us believe:
>
>Do any of you experts out there have any ideas about this?  When is it 
>better to pass a handle, and when is it better to pass an address? 

	It's alwasy better to allow Windows to do what memory
	management it will.  The way to do this is to have the
	memory locked down only when you need it to be, meaning
	just pass the handles.  Unless it is necessary to
	manipulate the contents of the memory both inside and
	outside of the methods in question (which is poor design
	anyway).



-- 
Paul C. David		pdavid@polyslo.CalPoly.EDU
California Polytechic State University, San Luis Obispo
Home of the six year or 60,000 mile undergrad degree