Skip to content

typedef for status return values #888

@CDKnightNASA

Description

@CDKnightNASA

Is your feature request related to a problem? Please describe.
Currently most CFE API's return a status code (the return type defines as int32.) The numeric return type is somewhat unclear and could result in confusion with other types of information (such as inadvertent confusion with return values from OSAL functions or numeric ID's).

Describe the solution you'd like

typedef int32 CFE_Status_t;

CFE_Status_t CFE_SB_CreatePipe()...

In order to facilitate better coding practices, I also propose a utility function:

bool CFE_Status_IsSuccess(CFE_Status_t status); // returns true if the status is a success return value, false if not (currently < 0 is an error condition, >= 0 is success with possible further status details.)

Describe alternatives you've considered
This will require quite a lot of code change but could be migrated incrementally as creating the typedef to the same type will be compatible. Eventually it could be changed to a struct wrapper or enum or something that will result in compiler errors when the type is considered a numeric type.

Requester Info
Christopher.D.Knight@nasa.gov

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions