Symbian OS Development Beginner's Manual 7 descriptors

Source: Internet
Author: User

The Symbian OS does not use a string of C strings (char*) or C + + that we are familiar with. Symbian's string is implemented through descriptor. Our first Symbian program, written version HelloWorld, is used in this way: _lit (Khelloworldtext, "Hello world! n "); console->printf (Khelloworldtext); _lit () is a macro that declares a descriptor:khelloworldtext with the contents" Hello world! ". The following console->printf parameter is a descriptor. Descirptor is a flexible design that takes full account of the limitations of small devices. This provides a very class, some can be modified, some cannot be modified, some on the stack, some on the heap. The NEWLC site has a descriptor chart: Http://www.newlc.com/article.php3? Id_article=12. It contains eight classes, which are not all descriptor classes, but are sufficient for the current use of our course. Where Tdesc is the most basic class. All other descriptor classes are inherited by it. Tdes is the most basic class that can be modified. All classes with the C suffix are not modifiable.

The chart below is a memory sketch of the 5 most commonly used descriptor classes.

The 5 in the tbufc<5> is its length, which represents the string "NEWLC", which is not to be changed.

Tbuf<8> 8 is its maximum length, and currently only uses 5 bytes, its contents are modifiable, but note that the content length can not be greater than his maximum length tptrc is a descriptor pointer class, it is an unmodified pointer, pointing to an immutable "NEWLC "The address.

Tptr is a modifiable descriptor pointer class that points to the address of a modifiable "NEWLC".

HBUFC's H stands for heap, which is specifically used to create strings on heap, and the strings of other descriptor classes are generally placed on stack.

In general, use heap memory as much as possible, because stack memory is more limited, if a large number of strings in the stack will easily lead to low memory.

These classes are used by many functions to modify and query their strings, and you can refer to the API Reference in the developer library. _lit () also has a simpler version, in which two lines in HelloWorld can be rewritten as: console->printf (_l ("Hello world! n "));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.