You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
For Message ID's, cFS generally use 0x%08X but sometimes it's printed with 0x%08x (lowercase a-f), or without the 0x, or even as %d or %u. (Although I don't know if that's used anymore.)
Describe the solution you'd like
Per https://en.wikipedia.org/wiki/C_data_types#Printf_and_scanf_format_specifiers C99 added printf format string macros for int types and it would be keen to follow this practice. I suggest PRIxMSG or PRIdMSG for printing (generally, sending an event message) a message ID in hex or decimal (defined as "0x%08X" and "%u" for unsigned integer (32-bit) MsgIds. So instead of:
...SendEvent(..."Error: unable to process message (MsgId=0x%08X)", MsgId)
it would be:
...SendEvent(..."Error: unable to process message (MsgId=" PRIxMSG ")", MsgId)
Describe alternatives you've considered
Leave well enough alone...:D
Additional context
Add any other context about the feature request here.
As long as it works everywhere I like this approach. Would really clean up our print formats (along with using the standard macros instead of doing casts everywhere which for some cases trigger static analysis warnings). We can define the custom macros with the typedef so they are easy to keep in sync, etc.
astrogeco
added
CCB:Ready
Ready for discussion at the Configuration Control Board (CCB)
and removed
CCB:Ready
Ready for discussion at the Configuration Control Board (CCB)
labels
Nov 3, 2021
Alternative - provide a "ToString" API? This then could avoid the messy format and the additional conversion from opaque (for opaque types). Another alternative is to preprocess the format string with custom values...
Example of local type where a ToString would help would be to convert CFE_Status_t would really help! And actually use it instead of printing an integer.
Could implemented using snprintf... or could have API's with common front end logging capability that you could specify where the message goes.
Is your feature request related to a problem? Please describe.
For Message ID's, cFS generally use 0x%08X but sometimes it's printed with 0x%08x (lowercase a-f), or without the 0x, or even as %d or %u. (Although I don't know if that's used anymore.)
Describe the solution you'd like
Per https://en.wikipedia.org/wiki/C_data_types#Printf_and_scanf_format_specifiers C99 added printf format string macros for int types and it would be keen to follow this practice. I suggest PRIxMSG or PRIdMSG for printing (generally, sending an event message) a message ID in hex or decimal (defined as
"0x%08X"
and"%u"
for unsigned integer (32-bit) MsgIds. So instead of:...SendEvent(..."Error: unable to process message (MsgId=0x%08X)", MsgId)
it would be:
...SendEvent(..."Error: unable to process message (MsgId=" PRIxMSG ")", MsgId)
Describe alternatives you've considered
Leave well enough alone...:D
Additional context
Add any other context about the feature request here.
Requester Info
Christopher.D.Knight@nasa.gov
The text was updated successfully, but these errors were encountered: