As revised 2006.08.23
Bionic Buffalo Tech Note #84
ptr_to_char = ( char * ) “fine “ ;
widestring = “a ” + ptr_to_char + L”pickle” ; // “a fine pickle”
operator can be used to extract the buffer pointer (
variables of these types. A subscript can be used to reference a particular character of the string.
represents an ISO 10646 character. (For almost all purposes, this is a Unicode character.) The
generated C type is opaque to the application, but it can be assigned to a numeric type to extract the
numeric value of the character. Unlike
, a variable of type
will always be able to
contain any ISO 10646 character.
is a string of ISO 10646 characters. (Practically, a Unicode string.) It can be mixed with
types in expressions; each type will be promoted to
the next type as needed.
is a linked list. A variable of this type is declared as
is the type of element
in the list. Lists can be concatenated to form bigger lists (
list1 = list2 + list3
Elements can be prepended to the beginning (
elem1 + list1
) or appended to the end (
). A subscript can be used to reference a specific element (
list1 [ n ]
). Negative subscripts
cause the list elements to be referenced from the end, so
refers to the last element.
operator returns the number of elements in the list. The code will not give up the
address of a list element: you cannot write
Using a subscript beyond the bounds of the list simply causes the reference to wrap around. In other
is equivalent to
list1[n mod length_of
. If there are no elements in the list, then any reference to an element is equivalent to a
reference to a block of
When a subscript is followed by an exclamation mark, the referenced element is deleted from the list.
deletes the last element of the list, assigning its value to
is almost the same as list, except for the implementation. Whereas
is implemented as
a linked list,
is implemented as a flexible vector of the elements. Otherwise,
are the same as
s. A sequence is roughly equivalent to an array with flexible bounds.
must be expanded, then the entire sequence buffer will be reallocated, and the old
buffer copied to the new buffer. If an element is prepended to the beginning, then all the other values
must be pushed up to make room. If an element is deleted from the middle, then the other elements
above it must be moved downward to fill in the space. These can be expensive. The runtime will attempt
to preallocate a buffer bigger than necessary, so reallocation is minimized. Furthermore, the buffer will
be allocated in segments, and indexed, so the maximum disruption will be to a segment rather than to the
Copyright 2006 Bionic Buffalo. All rights reserved.
File tn0084; Modified 20060830 08:00:17
Page 4 of 12