VMS Help  —  CC  Messages  ANSIALIASCAST
 Message        <Context> a pointer to <type1> is being cast to a
                pointer to <type2>.  Using ANSI aliasing rules, the
                compiler may subsequently assume that the two pointer
                types are pointing to different storage locations.

 Description    The C standard allows a compiler to assume that these
                two pointer types will point to different storage
                locations.  The compiler will make this assumption
                whenever ansi aliasing is enabled on the command
                line, either directly or via another switch.  The
                cast in itself does not violate aliasing rules, e.g.
                you might cast the pointer value back to an allowed
                type before you use it to access memory.  But the
                compiler cannot generally determine whether or not
                you do that.  If your code accesses the memory
                designated by this pointer value using both of these
                pointer types, you may get unexpected results when
                ansi aliasing is enabled.

 User Action    Casting through pointer to void will silence this
                message.  But if the end result is that the same
                memory still gets accessed through different types
                that are not permitted under the aliasing rules, you
                may still get unexpected results.  If compiling
                without ansi aliasing corrects the behavior of your
                program, your code almost certainly violates the
                aliasing rules in a way that the compiler cannot
                detect.
Close Help