diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-37057FD5-7ED0-5B18-9C28-39F6816D7627.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-37057FD5-7ED0-5B18-9C28-39F6816D7627.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,71 @@ + + + + + +Arrays +within structs +

A declaration of a struct member may either be a simple type-name member-name, +or it may be an array of values of identical type.

+

Arrays are always indicated by square brackets:

+STRUCT HAS_ARRAY + { + STRUCT elements[]; + } +

In the example above, the HAS_ARRAY struct has one array +member, elements. Each member of elements is +of STRUCT type.

+

Array size

+

If you specify the array size, inside the square brackets, then the generated +resource will contain no count of the number of elements. So this resource:

+STRUCT FIXED_ARRAY + { + WORD elements[3]; + } + +RESOURCE FIXED_ARRAY example1 + { + elements={9,8,7}; + } +

will generate the output

+0x09 0x00 0x08 0x00 0x07 0x00 +

For variable length arrays, a count of the number of elements precedes +the resource. The default for this is a word, but by prefixing the struct +definition with LEN BYTE it will be a byte count. So the +following resource:

+STRUCT VAR_ARRAY + { + WORD elements []; + } + +RESOURCE VAR_ARRAY example2 + { + elements={9,8,7}; + } +

will generate the output

+0x03 0x00 0x09 0x00 0x08 0x00 0x07 0x00 +

whereas this resource:

+STRUCT VAR_ARRAY2 + { + LEN BYTE WORD elements[]; + } + +RESOURCE VAR_ARRAY2 example3 + { + elements={9,8,7}; + } +

will generate this output

+0x03 0x09 0x00 0x08 0x00 0x07 0x00 +

The compiler allows you to prefix LEN BYTE or LEN +WORD even for fixed length arrays, but it has no effect. Fixed length +arrays do not generate an element count.

+
+How to initialise +array RESOURCE members +
\ No newline at end of file