Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Violation for rule 109
#4
Rule 18.2 references two undefined behaviours that are described in the C90 standard. Undefined 34 relates to assignment of overlapping objects. Undefined 55 relates to copying memory using library functions other than memmove (this function is designed to permit overlapping memory areas to be copied). The rule therefore covers both assignment and copying using library functions.

The standard defines assignment between overlapping objects only when both objects overlap exactly and have the compatible types, ignoring type qualifiers. Therefore, assigning one member of a union to another member of the same union would seem to be well defined and is therefore permitted by Rule 18.2, although unions are not permitted by Rule 18.4.
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)