BeBits Information Developer Central Submit Application Your Account Web Links Contact Us
BeBits
DeallocationRightsErrors
I think we should change the variable names to indicate ownership. This is only important for allocated data, generally passed by pointer. (floats, etc. get copied) Ownership in this case comes down to who has the right to deallocate the data, caller or callee.

Errors from misunderstanding this distinction result in two bad kinds of errors. First, if both deallocate the data, the program will usually crash. Second, if neither eventually deallocates the data, then the program has a memory leak. Leaking memory can result in poor performance and eventually a crash due to lack of memory.

I don't have a concrete proposal for how we should change the names. For calling arguments, one way of passing the data "gives" the data to the called function. The other way of passing the data "lends" the data to the called function. There is also a similar division in return arguments. A returned value can be "given" to the caller, or it can be "lent" to the caller. The distinction in return values could possibly be indicated in the method name.

shatty!


PAGE VISITS
912

LINKS HERE
ImprovedDocumentation

NEW PAGES
CrosscompilingFirefox
BuildingCairo
StoringDataInBetweenOSes
ScriptingBeosRuby
ScriptingBeosPython
HaikuOS
QemUwinbe
MinimalBeos
XpMBRoverwrite
SteveSakoman

RECENT CHANGES
CorumIII
BeUserProfiles
PhilipDybowski
BuildingFirebird
FrontPage
BeAcademic
CrosscompilingFirefox
HowTo
BuildingCairo
BeCommunity
Edit Page | Front Page | BeBits
Site content is in the public domain. Unless otherwise noted, everything else is copyright © 1999-2010 Haikuware. All Rights Reserved.
For more legal trivia, take a gander at our
Legal Stuff page and our Privacy Statement.