Ada 95 Quality and Style Guide Chapter 7

Chapter 7: Portability - TOC - 7.1 FUNDAMENTALS

7.1.2 Global Assumptions

guideline

  • Make informed assumptions about the support provided for the following on potential target platforms:

    - Number of bits available for type Integer (range constraints)
    - Number of decimal digits of precision available for floating-point types
    - Number of bits available for fixed-point types (delta and range constraints)
    - Number of characters per line of source text
    - Number of bits for Root_Integer expressions
    - Number of seconds for the range of Duration
    - Number of milliseconds for Duration'Small
    - Minimum and maximum scale for decimal types

  • Avoid assumptions about the values and the number of values included in the type Character.
  • instantiation

    These are minimum values (or minimum precision in the case of Duration'Small) that a project or application might assume that an implementation provides. There is no guarantee that a given implementation provides more than the minimum, so these would be treated by the project or application as maximum values also.

    - 16 bits available for type Integer (-2**15 .. 2**15 - 1)
    - 6 decimal digits of precision available for floating-point types
    - 24 bits available for fixed-point types
    - 200 characters per line of source text
    - 16 bits for expressions
    - -86_400 .. 86_400 seconds (1 day) for the range of Duration (as specified in Ada Reference Manual [1995, 9.6])
    - 20 milliseconds for Duration'Small (as specified in Ada Reference Manual [1995, 9.6])

    rationale

    Some assumptions must be made with respect to certain implementation-specific values. The exact values assumed should cover the majority of the target equipment of interest. Choosing the lowest common denominator for values improves portability. Implementations may supply an alternate character set specific to a locale or environment. For instance, the implementation on an IBM-compatible PC may support that machine's native character set rather than Latin 1. As a result, some character values may or may not be supported, for example, the smiley face.

    notes

    Of the microcomputers currently available for incorporation within embedded systems, 16-bit and 32-bit processors are prevalent. Using current representation schemes, 6 decimal digits of floating point accuracy imply a representation mantissa at least 21 bits wide, leaving 11 bits for exponent and sign within a 32-bit representation. This correlates with the data widths of floating point hardware currently available for the embedded systems market. A 32-bit minimum on fixed-point numbers correlates with the accuracy and storage requirements of floating point numbers. The 16-bit example for Root_Integer expressions matches that for Integer storage. (The 32-bit integers can be assumed if the application will only be considered for 32-bit processors with a corresponding 32-bit operating system and supporting compiler.)

    The values for the range and accuracy of values of the predefined type Duration are the limits expressed in the Ada Reference Manual (1995, 9.6). You should not expect an implementation to provide a wider range or a finer granularity.

    A standard-mode Ada character set of Latin 1 can be assumed in most cases for the contents and internal behavior of type Character and packages Character.Latin_1, Character.Handling, and Strings.Maps. However, this does not mean that the target hardware platform is capable of displaying the entire character set. You should not use a nonstandard Ada character set unless intentionally producing a nonportable user interface with a specific purpose.


    < Previous Page Search Contents Index Next Page >
    1 2 3 4 5 6 7 8 9 10 11
    TOC TOC TOC TOC TOC TOC TOC TOC TOC TOC TOC
    Appendix References Bibliography