Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dir 4.8 2 struct pointers in a Translation unit
#1
What happens if there are 2 pointers to a struct/union in a translation unit. One which accesses the details of the struct/union and the other does not. For Example:
File1.h
Code:
struct X { int32_t i1 };
  typedef struct X * ptrX;
  extern  void use_ptrX ( ptrX p );

File1.c
Code:
void fn ( ptrX a, ptrX b )
  {     /* no reference to a->i1 in translation unit  - does the type of "a" need to be opaque? */
     use_ptrX ( a );
     use_int32 ( b -> i1 ) ;
}
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)