Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-27AAD3D5-AEC0-5A33-B14A-2E8B8D21CDAA" xml:lang="en"><title>How
to use the trailing-C naming convention</title><shortdesc>This document describes how functions named with a trailing C are
handled on the stack.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>The case of allocating an object and pushing it to the cleanup stack is
sufficiently common that allocation functions are often coded to do both in
a single operation. For example, there is a <codeph>User::AllocLC()</codeph> whose
semantics are to call <codeph>User::Alloc()</codeph> to allocate the memory,
leave if the allocation failed, and push to the cleanup stack if it succeeded.</p>
<p>The trailing <codeph>C</codeph> indicates that the item is pushed to the
cleanup stack if successfully allocated: the resulting function can be referred
to as a <keyword>C function</keyword>: in the great majority of cases, C functions
are also <keyword>L functions</keyword>. Any function which calls <codeph>User::AllocLC()</codeph> to
allocate a buffer should also use this naming convention. </p>
<p>The function that calls a -<codeph>C</codeph> function must pop (and destroy,
if the -<codeph>C</codeph> function allocated an object) the object from the
stack when its use is complete.</p>
</conbody></concept>