Skip to content

Commit 8c2503c

Browse files
committed
Code review suggestions
Signed-off-by: Gaurav Aggarwal <[email protected]>
1 parent 6060be6 commit 8c2503c

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

MISRA.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ _Ref 8.4.1_
3636

3737
_Ref 11.3.1_
3838

39-
- MISRA C:2012 Rule 11.3: A cast shall not be performed between a pointer to object
40-
type and a pointer to a different object type.
41-
The rule requires not to cast a pointer to object into a pointer to a
42-
different object to prevent undefined behavior due to incorrectly aligned.
43-
To support static memory allocation, FreeRTOS creates static type kernel
44-
objects which are aliases for kernel object type with prefix "Static" for
45-
data hiding purpose. A static kernel object type is guaranteed to have the
46-
same size and alignment with kernel object, which is checked by configASSERT.
47-
Static kernel object types include StaticEventGroup_t, StaticQueue_t,
48-
StaticStreamBuffer_t, StaticTimer_t and StaticTask_t.
39+
- MISRA C:2012 Rule 11.3: A cast shall not be performed between a pointer to
40+
object type and a pointer to a different object type.
41+
This rule prohibits casting a pointer to object into a pointer to a
42+
different object because it may result in an incorrectly aligned pointer,
43+
leading to undefined behavior. Even if the casting produces a correctly
44+
aligned pointer, the behavior may be still undefined if the pointer is
45+
used to access an object. FreeRTOS deliberately creates external aliases
46+
for all the kernel object types (StaticEventGroup_t, StaticQueue_t,
47+
StaticStreamBuffer_t, StaticTimer_t and StaticTask_t) for data hiding
48+
purposes. The internal object types and the corresponding external
49+
aliases are guarnteed to have the same size and alignment which is
50+
checked using configASSERT.
4951

5052

5153
### MISRA configuration

0 commit comments

Comments
 (0)