Synchronized (not SLACK)

From: William M. Klein (wmklein_at_nospam.netcom.com)
Date: 07/30/04

  • Next message: Lueko Willms: "Re: PIC S9(11).9(2) USAGE DISPLAY illegal?"
    Date: Fri, 30 Jul 2004 04:05:08 GMT
    
    

    As a follow-up on another thread (and somewhat as a correction to what I
    posted), the 2002 Standard does not (at least at quick glance) use the term
    "slack" (for bytes or bits inserted within records). The following is the
    entire text of what I was trying to explain when I originally commented that an
    file with a record layout might have "unexpected garbage" between fields.

    >From page 110 of the 2002 Standard,

    "
    8.5.1.5.4 Item alignment for increased object-code efficiency

    Some computer memories are organized in such a way that there are natural
    addressing boundaries in the computer memory, such as word boundaries, half-word
    boundaries, and byte boundaries. The way in which data is stored is determined
    by the runtime module, and need not respect these natural boundaries.

    However, certain uses of data in such constructs as arithmetic operations or
    subscripting may be facilitated if the data is stored so as to be aligned on
    these natural boundaries. Specifically, additional machine operations might be
    required at execution time for the accessing and storage of data if portions of
    two or more data items appear between adjacent natural boundaries, or if certain
    natural boundaries bifurcate a single data item.

    Data items that are aligned on these natural boundaries in such a way as to
    avoid such additional machine operations are defined to be synchronized.

    Synchronization can be accomplished in two ways:

        1) By use of the SYNCHRONIZED clause.

        2) By recognizing the appropriate natural boundaries and organizing the data
    suitably without the use of the SYNCHRONIZED clause.

    Each implementor who provides for special types of alignment shall specify the
    precise interpretations that are to be made. The use of such items within a
    group may affect the results of statements in which the group is used as an
    operand. Each implementor who provides for these special types of alignment
    shall describe the effect of the implicit FILLER and the semantics of any
    statement referencing these groups."

    -- 
    Bill Klein
     wmklein <at> ix.netcom.com
    

  • Next message: Lueko Willms: "Re: PIC S9(11).9(2) USAGE DISPLAY illegal?"