Symbian3/SDK/Source/GUID-0D619063-F2DB-53FC-A5E6-BC09AD915FA4.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?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-0D619063-F2DB-53FC-A5E6-BC09AD915FA4" xml:lang="en"><title>Resource
member initialisation overview</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>The resource initialiser has different forms depending on whether a single,
simple, member is being initialised, or whether a struct or an array is being
initialised:</p>
<codeblock xml:space="preserve">&lt;resource-initialiser&gt;
<b>resource-initialiser ::</b>=
	&lt;member-name&gt; [ (&lt;length-limit&gt;) ] = &lt;initialiser&gt;&lt;initialiser&gt;
<b>initialiser :</b>:=
	&lt;simple-initialiser&gt; | &lt;struct-initialiser&gt; | &lt;array-initialiser&gt;</codeblock>
<p>Resource members may be initialised by default (in the struct definition)
or explicitly initialised (in the resource definition).</p>
<p>In general,</p>
<ul>
<li id="GUID-E712BF25-9F6A-5E9E-8F85-7ACBF010F7C1"><p>If a member is initialised
in a <codeph>RESOURCE</codeph> statement, then that is its value.</p> </li>
<li id="GUID-FF416E99-A21F-5525-B01C-BEA51B216E25"><p>If a member is initialised
in a <codeph>STRUCT</codeph> statement, then that is its value for all resources
which do not explicitly initialise it.</p> </li>
<li id="GUID-CA918017-F0C1-5E1F-8D8A-893653C2D94E"><p>If a member is <i>neither</i> initialised
in a <codeph>RESOURCE</codeph> statement <i>nor</i> a <codeph>STRUCT</codeph> statement,
then: <codeph>BYTE</codeph>, <codeph>WORD</codeph> and <codeph>DOUBLE</codeph> members
contain zero; <codeph>TEXT</codeph>, <codeph>LTEXT</codeph> and <codeph>BUF</codeph> members
contain an empty string.</p> </li>
<li id="GUID-590BD79C-AB1B-537C-9A23-3F0902539B3A"><p>It is an error for <codeph>LINK</codeph> and <codeph>LLINK</codeph> members
to have no explicit value, so they must be initialised, either by default
(in the <codeph>STRUCT</codeph> statement) or explicitly (in the <codeph>RESOURCE</codeph> statement).</p> </li>
<li id="GUID-F0C0C9CB-625B-5307-81EF-F78AC284CB0B"><p><codeph>SRLINK</codeph> members
may not be initialised (either in the <codeph>STRUCT</codeph> statement or
a <codeph>RESOURCE</codeph> statement) since they are automatically assigned
the resource id of the resource in which they appear.</p> </li>
<li id="GUID-23FBAA84-2826-5972-9D75-AEB2082A01D7"><p>Members which are themselves <codeph>STRUCT</codeph> s
may not be default initialised. They can only be initialised in the <codeph>RESOURCE</codeph> definition.
If they are not explicitly initialised, they will take up zero bytes in the
resource file. For example, given the following <codeph>STRUCT</codeph> definition:</p> <codeblock id="GUID-82D529DD-EF78-56B6-96CC-D245C0C5C046" xml:space="preserve">STRUCT TEST2 
 {
 WORD    value;
 STRUCT  tester;
 }</codeblock> <p>The following <codeph>RESOURCE</codeph> statement only generates
the two bytes <codeph>0xFF 0x00</codeph>.</p> <codeblock id="GUID-B97A619C-8299-5FC9-AD49-658F21568E2F" xml:space="preserve">RESOURCE TEST2 item
 {
 value=255;
 }</codeblock> </li>
</ul>
</conbody></concept>