Skip to content

Conversation

@SakiTakamachi
Copy link
Member

No description provided.

Copy link
Member

@nielsdos nielsdos left a 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.


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,
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

@nielsdos

Ahhhh, indeed.....

Do you think it would be redundant to define a new type just for this?

Copy link
Member

Choose a reason for hiding this comment

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

Feels a bit silly

@SakiTakamachi
Copy link
Member Author

@nielsdos

bc_num has been restored, I merge it later!

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

Still OK

@SakiTakamachi SakiTakamachi merged commit c927d24 into php:master Apr 11, 2025
9 checks passed
@SakiTakamachi SakiTakamachi deleted the bcmath/add_const branch April 11, 2025 03:39
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