C has pretty much non-existent type safety for integers and enums, so you won't get any better type safety from using the enum. It doesn't exactly help that enumeration constants (these: RETURN_OK
) are actually defined to be of type int
and not of the enum type as would make more sense.
Though as mentioned in the question of How to create type safe enums? you can also get ever so slightly better type safety in case you use pointers instead of pass-by-value.
Static analysers may be able to find type-related bugs in case you use an enum type - but that only matters in case you actually use static analysers. For example MISRA-C uses a system where enums are to be regarded and treated as if they were a type of their own, so a MISRA checker would give errors when using raw integer values instead of enumeration constants etc.
But what it boils down to in the end is de facto coding standards in C code bases. It is a very common API design to reserve the return value of all functions in a library for error codes, and then that error code is typically given a type of its own, often in the form of an enum. So I would go with the enum
version because that's what most people out there are using, no matter if coding for *nix, Windows or embedded systems.