Documentation  |   Table of Contents   |  < Previous   |  Next >   |  Index

1    Language Overview

Palm OS® Protein C/C++ Compiler Language & Library Reference

Palm OS® Developer Suite

The Palm OS® Protein C/C++ Compiler is a full-featured, standards-based, optimizing C/C++ compiler.

  • The Palm OS compiler supports the C language standard ANSI/ISO/IEC 9899:1999, commonly known as C99, as a freestanding implementation. The compiler uses this language by default for C code.

    It is required that you understand both the ANSI/ISO standard C language and library. The ANSI/ISO 9899:1999 C standards document completely describes the standard C library functions, as do several widely-used references including:

    • The C Programming Language, Second Edition, by Brian W. Kernighan and Dennis M. Ritchie, Prentice Hall, Inc., 1988, ISBN 0-13-1103628.
    • C: A Reference Manual, Fifth Edition, by Samuel P. Harbison, Prentice Hall, Inc., 2002, ISBN 0-13-089592.
    • Online at www.dinkumware.com/refxc.html.
  • The Palm OS compiler supports the C++ language standard ANSI/ISO/IEC 14882:1998(E). The C++ language standard is also documented in other widely-used references including The C++ Programming Language, Third Edition, by Bjarne Stroustrup, Addison-Wesley, 2000, ISBN 0-20-1700735.

The Palm OS compiler takes as input one or more C and/or C++ language text files (written according to the standards above) and produces a corresponding number of assembly language source files (see the Palm OS Protein C/C++ Compiler Tools Guide for more details).

C Technical Requirements ^TOP^

In addition to the ANSI/ISO/IEC requirements previously mentioned, the C facilities of the Palm OS compiler meet the following additional technical requirements:

  • Supports a variety of useful extensions to the base language, particularly those useful to the ARM architecture.
  • Supports compiling with extensions removed that are incompatible with the appropriate ANSI specification.
  • Produces code for the ARM instruction set for version 4T architecture microprocessors as defined in the ARM Reference Manual, revision E.
  • Adheres to the C calling conventions of the base standard ABI for the ARM architecture.
  • Adheres to the shared library conventions documented in the ARM-Thumb Shared Library Architecture (ASHLA, document number MADEIRA-0020-CUST-DDES A-01).
  • Produces DWARF version 1.1 debugging information, if debugging output is requested.

C++ Technical Requirements ^TOP^

In addition to the ANSI/ISO/IEC requirements previously mentioned, the C++ facilities of the Palm OS compiler meet the following additional technical requirements:

  • Adheres to the C++ calling conventions of the base standard ABI for the ARM architecture.

Limitations ^TOP^

There are restrictions on some of the newer, more complex, and more exotic features of the relevant standards.

Restrictions on C99 ^TOP^

The C99 implementation is limited is the following ways:

  • Complex arithmetic is not supported, and thus all usages of the _Complex or _Imaginary types are unsupported. This includes:
    • float _Complex
    • double _Complex
    • long double _Complex
    • float _Imaginary
    • double _Imaginary
    • long double _Imaginary
  • Avoid use of the long double type in the Simulator environment. It is unsupported and should not be used. There is a binary compatibility problem with i386 gcc and the compiler used to build the Simulator.
  • Floating-point environment control is not available, therefore the __STDC_IEC_559__ and __STDC_IEC_559_COMPLEX__ macros are not defined.
  • Variable length arrays are available, however during debugging, the array length may not be available. The allocation of local VLAs is implemented via calls to malloc() and free().

Restrictions on C++ ^TOP^

The C++ implementation is limited is the following way:

  • Exported templates are not supported.

Restrictions on Data Types ^TOP^

Table 1.1 lists the maximum and minimum sizes of the integral data types supported by the Palm OS Protein C/C++ Compiler.

Table 1.1  Maximum and minimum sizes of integer types

Constant

Value

Description

CHAR_BIT

8

Number of bits in a byte.

CHAR_MAX

255

Maximum value of an object of type char.

CHAR_MIN

0

Minimum value of an object of type char.

INT_MAX

+2147483647

Maximum value of an object of type int.

INT_MIN

-2147483648

Minimum value of an object of type int.

LONG_MAX

+2147483647

Maximum value of an object of type long int.

LONG_MIN

-2147483648

Minimum value of an object of type long int.

LLONG_MAX

+9223372036854775807

Maximum value of an object of type long long int.

LLONG_MIN

-9223372036854775808

Minimum value of an object of type long long int.

MB_LEN_MAX

1

Maximum number of bytes in a multibyte character, regardless of locale.

SCHAR_MAX

+127

Maximum value of an object of type signed char.

SCHAR_MIN

-128

Minimum value of an object of type signed char.

SHRT_MAX

+32767

Maximum value of an object of type short int.

SHRT_MIN

-32768

Minimum value of an object of type short int.

UCHAR_MAX

255

Maximum value of an object of type unsigned char.

USHRT_MAX

65535

Maximum value of an object of type unsigned short.

UINT_MAX

4294967295

Maximum value of an object of type unsigned int.

ULONG_MAX

4294967295

Maximum value of an object of type unsigned long int.

ULLONG_MAX

18446744073709551615

Maximum value of an object of type unsigned long long int.

Table 1.2 lists constants that describe the attributes of floating-point data types.

Table 1.2  Constants describing attributes of floating-point numeric types

Constant

Value

Description

FLT_EVAL_METHOD

0

float and double are not the same precision.

FLT_ROUNDS

1

Rounding is always performed toward the nearest integral value.

DBL_DIG

15

The number of digits of decimal precision for type double.

DBL_MANT_DIG

53

The number of bits used to represent the mantissa for type double.

DBL_MAX_10_EXP

308

The maximum decimal exponent for type double.

DBL_MAX_EXP

1024

The maximum binary exponent for type double.

DBL_MIN_10_EXP

-308

The minimum decimal exponent for type double.

DBL_MIN_EXP

-1021

The minimum binary exponent for type double.

DECIMAL_DIG

17

The number of decimal digits to which any floating-point number of type long double can be rounded, and back, without changing its value.

FLT_DIG

6

The number of decimal digits of precision for type float.

FLT_MANT_DIG

24

The number of bits in the mantissa for type float.

FLT_MAX_10_EXP

38

The maximum decimal exponent for type float.

FLT_MAX_EXP

128

The maximum binary exponent for type float.

FLT_MIN_10_EXP

-37

The minimum decimal exponent for type float.

FLT_MIN_EXP

-125

The minimum binary exponent for type float.

FLT_RADIX

2

The exponent radix.

LDBL_DIG

15

The number of decimal digits of precision for type long double.

LDBL_MANT_DIG

53

The number of bits in the mantissa for type long double.

LDBL_MAX_10_EXP

308

The maximum decimal exponent for type long double.

LDBL_MAX_EXP

1024

The maximum binary exponent for type long double.

LDBL_MIN_10_EXP

-308

The minimum decimal exponent for type long double.

LDBL_MIN_EXP

-1021

The minimum binary exponent for type long double.

DBL_MAX

1.79769313486231571e+308

The maximum value that can be represented by type double.

FLT_MAX

3.40282347e+38

The maximum value that can be represented by type float.

LDBL_MAX

1.79769313486231571e+308

The maximum value that can be represented by type long double.

DBL_EPSILON

2.2204460492503131e-16

The smallest value such that 1.0 + DBL_EPSILON is not equal to 1.0 for type double.

DBL_MIN

2.22507385850720138e-308

The minimum value that can be represented by type double.

FLT_EPSILON

1.19209290e-7

The smallest value such that 1.0 + FLT_EPSILON is not equal to 1.0, for type float.

FLT_MIN

1.17549435e-38

The minimum value that can be represented by type float.

LDBL_EPSILON

2.2204460492503131e-16

The smallest value such that 1.0 + DBL_EPSILON is not equal to 1.0 for type long double.

LDBL_MIN

2.22507385850720138e-308

The minimum value that can be represented by type long double.