ILE C/C++ Compiler Reference


disjoint



>>-#--pragma--disjoint------------------------------------------>
 
                             .--------------------------.
      .---.                  |    .---.                 |
      V   |                  V    V   |                 |
>--(----*-+----identifier------,----*-+----identifier---+--)---><
 
 

Description

This directive informs the compiler that none of the identifiers listed shares the same physical storage, which provides more opportunity for optimizations. If any identifiers actually share physical storage, the pragma may cause the program to give incorrect results.

An identifier in the directive must be visible at the point in the program where the pragma appears. The identifiers in the disjoint name list cannot refer to any of the following:

Example

    int a, b, *ptr_a, *ptr_b;
    #pragma disjoint(*ptr_a, b)  // *ptr_a never points to b
    #pragma disjoint(*ptr_b, a)  // *ptr_b never points to a
    one_function()
    {
        b = 6;
        *ptr_a = 7;     // Assignment does not alter the value of b
        another_function(b);    // Argument "b" has the value 6
    }

Because external pointer ptr_a does not share storage with and never points to the external variable b, the assignment of 7 to the object that ptr_a points to will not change the value of b. Likewise, external pointer ptr_b does not share storage with and never points to the external variable a. The compiler can assume that the argument of another_function has the value 6 and will not reload the variable from memory.


[ Top of Page | Previous Page | Next Page | Table of Contents ]