OSF DCE Application Development Guide--Core Components

Interface Definition Language
17.14.6 Strings
IDL implements strings as one-dimensional arrays to which the string attribute is
assigned. The element type of the array must resolve to one of the following:
Type char
Type byte
A structure all of whose members are of type byte or of a named type that resolves to
byte
A named type that resolves to one of the previous three types
Type unsigned short
Type unsigned long
A named type that resolves to unsigned short or unsigned long
Strings built from byte or char data types are referred to as byte-string types while
strings built from unsigned short or unsigned long types are called integer-string types.
Integer string types allow for multioctet character sets whose characters are represented
by 16-bit or 32-bit quantities, rather than as groups of bytes, for example:
/* A structure that contains a fixed string */
/* and a conformant string */
typedef unsigned long PRIVATE_CHAR_32;
typedef struct {
[string] PRIVATE_CHAR_32 fixed[27];
[string] PRIVATE_CHAR_32 conf[];
} two_strings;
/* A structure that contains pointers to two strings */
typedef unsigned short PRIVATE_CHAR_16;
typedef struct {
[string] PRIVATE_CHAR_16 *astring;
[string] PRIVATE_CHAR_16 *bstring;
} stringptrs;
Integer-string types use the array element zero (0) to specify the string terminator, while
byte-string types use the NULL character. Both byte-type and integer-type strings
conform to the same usage rules.
An array with the string attribute represents a string of characters. The string attribute
does not specify the format of the string or the mechanism for determining its length.
Implementations of IDL provide string formats and mechanisms for determining string
lengths that are compatible with the programming languages in which applications are
written. For DCE RPC IDL, the number of characters in a string array includes the
NULL terminator (for byte-string types) or the zero (0) terminator (for integer-string
types), and the entire terminated string is passed between stubs.
The array_bounds_declarator for a string array determines the maximum number of
characters in the array. Note that, when you declare a string, you must allocate space for
124245 Tandem Computers Incorporated 17 41