VMS Help  —  CC  Messages  SUBSCRBOUNDS
 Message        <Context> an array is being accessed outside the
                bounds specified for the array type.

 Description    The compiler has detected an array access that is
                outside the bounds of the array.  The array access
                might cause unpredictable behavior.  Note that in C,
                an array is declared using the number of elements,
                but the first element has subscript 0.  It is a
                common coding error to attempt to access the last
                element of an array of "n" elements using a subscript
                of "n" instead of "n - 1".  However, there are two
                common practices that intentionally employ
                out-of-bounds subscripts to useful/correct effects
                that are not reported by this message, but have
                separate optional messages.  First, taking the
                address of an array element that is exactly one
                beyond the last element of an array is completely
                valid in standard C as long as the address is not
                used to access memory.  The optional subscrbounds2
                message can be enabled to report taking the address
                of the array element exactly one beyond the last
                element.  Second, it is a somewhat common practice to
                declare the last member of a struct as an array with
                one element, and then allocate such structs at
                runtime with different sizes, recording the actual
                size in an earlier member of the struct.  The
                optional subscrbounds1 message can be enabled to
                report subscripts greater than zero applied to arrays
                declared with only one element.

 User Action    Specify an array subscript that is within the bounds
                of the array type.
Close Help