Palm OS Conventions

There are also a variety of Palm coding conventions that are useful to know. There are type conventions and standard naming practices for everything from functions to managers. It is worth getting a clearer idea of what these are before wading knee-deep into your first coding project. These are the ones you should learn.

Types

Here are the main types used by the Palm OS:

UInt32

An unsigned 32-bit integer.

Int32

A signed 32-bit integer.

UInt16

An unsigned 16-bit integer.

Int16

A signed 16-bit integer.

UInt8

An unsigned 8-bit integer.

Int8

A signed 8-bit integer.

Boolean

A 1-byte true or false value.

Char

A 1-byte character that will only work on systems with 1-byte encodings.

WChar

A 2-byte character suitable for all encodings (including for Japanese, Chinese, and so on).

Err

A 2-byte integer used for errors. The value errNone signifies no error.

Coord

A signed 2-byte integer used to represent a screen or window coordinate.

MemPtr

Specifies a (4-byte) pointer to an allocated chunk in memory.

MemHandle

A (4-byte) reference to a relocatable chunk of memory (see Chapter 6 for more details).

Function and Manager Naming Conventions

The Palm OS uses mixed-case for names, with an initial uppercase for functions and types. Constants and enumerations begin with lowercase letters. The following snippet of code shows the conventions in action (emphasis shows functions, types, and enumerations):

                  FormPtr form;
UInt32  romVersion;
FtrGet(sysFtrCreator, ...

Get Palm OS Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.