HP 3000 Manuals

Invalid Structure References [ HP C Programmer's Guide ] MPE/iX 5.0 Documentation


HP C Programmer's Guide

Invalid Structure References 

The HP 9000 Series 700/800 compiler does not allow structure members to
be referenced through a pointer to a different type of object.  The VAX
pcc and HP 9000 Series 200 and 500 compilers allow this.  Change any
invalid structure references to cast the pointer to the appropriate type
before referencing the member.  For example, given the following:

          struct x {
            int y;
          }z;
          char *c;
          c -> y=5;

c -> y=5; is invalid.  Instead, use the following code:

          c = (char *) &z;
          ((struct x *) c)->y = 5;



MPE/iX 5.0 Documentation