MSVC: Fix warning C4244 in zend_get_gc_buffer_use#20712
MSVC: Fix warning C4244 in zend_get_gc_buffer_use#20712wmamrak wants to merge 1 commit intophp:masterfrom
Conversation
|
Thank you @wmamrak! This looks right, but I believe that compiler warning fixes should target master. |
|
I followed the rules from here, but I assume you know better 😃 . Should I edit the PR and change the base, or create a new PR? Thank you. |
|
Yes you followed the rules right :) But it depends if we consider this a bug fix or a cosmetic change. In this case I think it's a cosmetic change because it's only masking a warning without fixing an actual bug. Which is fine, but only in master. Please rebase on master and change the base, I will merge after that. |
This PR addresses a compilation warning of the form: warning C4244: '=': conversion from '__int64' to 'int', possible loss of data The expression gc_buffer->cur - gc_buffer->start produces a temporary of type ptrdiff_t, which is then assigned to an int. It causes said compilation warning if these types do not match.
65fcd21 to
ba99fec
Compare
|
Rebased and changed the base. |
TimWolla
left a comment
There was a problem hiding this comment.
int is a terrible type and from what I see the gc internally uses uint32_t to store the n returned by the get_gc handler, so there additional type inconsistency. Would it instead make sense to adjust the signature of the get_gc() handler to either use uint32_t or to adjust everything to use ptrdiff_t instead?
This PR addresses a compilation warning of the form: warning C4244: '=': conversion from '__int64' to 'int', possible loss of data The expression gc_buffer->cur - gc_buffer->start produces a temporary of type ptrdiff_t, which is then assigned to an int. It causes said compilation warning when these types do not match.