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

zend_enum: Rename try parameter to avoid conflict with C++ #15259

Closed
wants to merge 1 commit into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Aug 6, 2024

try is a keyword in C++, and as such C++ code including <zend_enum.h> fails to compile unless a workaround is in place. To resolve this, we simply rename the parameter.

We choose try_from to make it clear that this parameter is true when the function is called from BackedEnum::tryFrom(). For consistency, we also rename the try parameter of zend_enum_from_base(), although that function is not exported.


Note that this is a follow-up on #15235, which has been closed for unknown reasons, but has been a valid request.

`try` is a keyword in C++, and as such C++ code including <zend_enum.h>
fails to compile unless a workaround is in place.  To resolve this, we
simply rename the parameter.

We choose `try_from` to make it clear that this parameter is true when
the function is called from `BackedEnum::tryFrom()`.  For consistency,
we also rename the `try` parameter of `zend_enum_from_base()`, although
that function is not exported.
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@iluuu1994
Copy link
Member

Maybe give credits to @oplanre :)

@cmb69 cmb69 closed this in 423fc81 Aug 7, 2024
@cmb69 cmb69 deleted the cmb/try-param branch August 7, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants