-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
Hi team,
To simplify repetitive error handling, the following macro was proposed:
#define luaxxx_error(code, op, msg) \
do { \
pr_err("%s: %s\n", (op), (msg)); \
return code; \
} while (0)This makes error handling very concise. However, a concern was raised that it hides the return statement, which can make control flow less explicit.
An alternative is the more traditional approach of using a helper function and calling return explicitly, like: if (err = check(...)) { return err; }.
I'm opening this issue to discuss which pattern we should prefer for the project. Should we favor the conciseness of a macro like luaxxx_error, or the clarity of an explicit return?
Looking forward to your thoughts.
Metadata
Metadata
Assignees
Labels
No labels