-
Notifications
You must be signed in to change notification settings - Fork 7.8k
ext/bcmath: Use const
qualifiers appropriately
#18284
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with this, please see my remark to check if this is what you intended.
ext/bcmath/bcmath.c
Outdated
@@ -1019,7 +1019,7 @@ static void bcmath_number_register_class(void) | |||
} | |||
|
|||
static zend_always_inline void bcmath_number_add_internal( | |||
bc_num n1, bc_num n2, bc_num *ret, | |||
const bc_num n1, const bc_num n2, bc_num *ret, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that bc_num is defined as follows: typedef struct bc_struct *bc_num;
Unfortunately, const bc_num
won't do what you probably think it does: it doesn't make the pointer const, it just makes the binding of the variable const. If it was written like bc_struct *n1
then n1
would be a const pointer if you added const before it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels a bit silly
bc_num has been restored, I merge it later! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still OK
No description provided.