diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-97C0A5B1-99AE-5F71-9092-A6976E54AEA7.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-97C0A5B1-99AE-5F71-9092-A6976E54AEA7.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,57 @@ + + + + + +How +to initialise STRUCT RESOURCE members +

<struct-initialiser> +

+

struct-initialiser ::= +

+

<struct-name> { <struct-initialiser-item-list> } <struct-initialiser-item> +

+

struct-initialiser-item ::= +

+

<member-name> = <initialiser> ;

+

To initialise a member of STRUCT type, give the struct-name with +which you wish to initialise it, and then specify each member of that struct +which you wish to initialise.

+

The member-names listed must be members of the struct-name struct. +Each initialise must be of a type compatible with the member +it is initialising.

+

Example

+

Given the previously defined struct types,

+STRUCT STRINGCOUNT + { + BUF message; + WORD num; + } +STRUCT SAMPLE + { + WORD anynumber; + STRUCT text; // should be a STRINGCOUNT + } +

the following example shows how to define the struct within a resource:

+RESOURCE SAMPLE show_how + { + anynumber=10; + text=STRINGCOUNT + { + message="Hello" + num=5; + }; + } +

Type safety

+

The compiler does not enforce type safety. Any struct can be used to initialise +a member declared to be of struct type. Usually, however, the designer of +the struct will have intended only one or a limited number of structs ever +be used to initialise a member. You should ensure that you initialise struct +members with the intended struct type.

+
\ No newline at end of file