-
Notifications
You must be signed in to change notification settings - Fork 227
Description
In 6.6, as we move to supporting MsgId's, MsgKey's, RouteIdx, and other types, we should move away from using native C types and wrapping the types in a struct to prevent accidentally using the wrong type in assignments and function calls.
This will, of course, require re-tooling any existing code that expects the type to be a simple type...
For example, instead of:
typedef uint16 CFE_SB_MsgId_t;
uint32 SomeFunction(CFE_SB_MsgId_t MsgId) {
/* ... */
return MsgId; /* this will work fine, even though it's bad behavior! */
}
Use:
typedef uint16 CFE_SB_MsgId_Atom_t;
typedef struct
{
CFE_SB_MsgId_Atom_t __MsgId; /* private, do not touch */
} CFE_SB_MsgId_t;
uint32 SomeFunction(CFE_SB_MsgId_t MsgId) {
/* ... */
return MsgId; /* will now give a compiler error */
}