Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a _RETURN_IF() fpp-macro #2034

Closed
tclune opened this issue Mar 27, 2023 · 0 comments
Closed

Create a _RETURN_IF() fpp-macro #2034

tclune opened this issue Mar 27, 2023 · 0 comments
Assignees
Labels
0 Diff Trivial The changes in this pull request are trivially zero-diff (documentation, build failure, &c.) ❗ High Priority This is a high priority PR 🎁 New Feature This is a new feature

Comments

@tclune
Copy link
Collaborator

tclune commented Mar 27, 2023

A common pattern is to return early from a procedure if a certain condition holds. E.g.,

if (cond) return

Unfortunately, this does not play well with our return code mechanism for error handling, which forces us to write instead:

if (cond) then
   _RETURN(_SUCCESS)
end if

I propose a new macro _RETURN_IF(...) that returns this to a 1-liner while retaining clarity.

@tclune tclune added 🎁 New Feature This is a new feature 0 Diff Trivial The changes in this pull request are trivially zero-diff (documentation, build failure, &c.) ❗ High Priority This is a high priority PR labels Mar 27, 2023
@tclune tclune self-assigned this Mar 27, 2023
tclune added a commit that referenced this issue Mar 27, 2023
mathomp4 added a commit that referenced this issue Mar 27, 2023
@tclune tclune closed this as completed in da2ba51 Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 Diff Trivial The changes in this pull request are trivially zero-diff (documentation, build failure, &c.) ❗ High Priority This is a high priority PR 🎁 New Feature This is a new feature
Projects
None yet
Development

No branches or pull requests

1 participant