Skip to content

Conversation

khwilliamson
Copy link
Contributor

We have modifiers like %z and %t to portably print items of the given type. This converts to use those in these files, removing casts that were previously used.

  • This set of changes does not require a perldelta entry.

regcomp.c Outdated
Comment on lines 13150 to 13151
(IV)val,
(IV)(val - scan)
Copy link
Contributor

Choose a reason for hiding this comment

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

You left the (IV) casts in; do you need to remove them for %zd?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I should have removed the casts; now done

We have modifiers like %z and %t to portably print items of the given
type.  This converts to use those in these files, removing casts that
were previously used.
Comment on lines -4387 to +4390
Perl_re_printf( aTHX_ "~ tying lastbr %s (%" IVdf ") to ender %s (%" IVdf ") offset %" IVdf "\n",
Perl_re_printf( aTHX_ "~ tying lastbr %s (%" IVdf ") to ender %s (%" IVdf ") offset %td\n",
SvPV_nolen_const(RExC_mysv1),
(IV)lastbr,
SvPV_nolen_const(RExC_mysv2),
(IV)ender,
(IV)(ender - lastbr)
(ender - lastbr)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if you're distinguishing ptrdiff_t and ssize_t here, or if you're using the assumption that regnode_offset is SSize_t (which it is, but I'm not sure you intend that to be visible.)

ender and lastbr are regnode_offsets which are SSize_t but you've retained the casts and IVdf for each of those.

I'd expect subtracting lastbr from ender to also be a SSize_t (%zd) but you've used %td.

Copy link
Contributor

Choose a reason for hiding this comment

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

Similar cases below, let me know if you want me to point each of them out.

* lib/unicore/Name.pm. 'code_point' in the name is expressed in hex. */
for (i = 0; i <= av_top_index((AV *) algorithmic_names); i++) {
IV j;
SSize_t j;
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand the code low and high represent a range of code points, and so hence j is also a code point.

What I'm not sure about is what controls the Perl extended valid range of code points, if it's limited to non-negative IV values this change is incorrect, since IV/UV can be larger than SSize_t.

It might be that the range here is always within the base unicode range, but I'm not sure we limit custom properties to that (or if those apply here.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants