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

Fix Issue 23480 - non-empty ForStatement Increment clause should requ… #14638

Merged
merged 7 commits into from
Nov 15, 2022

Conversation

ntrel
Copy link
Contributor

@ntrel ntrel commented Nov 13, 2022

…ire a side effect

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @ntrel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
23480 enhancement non-empty ForStatement Increment clause should require a side effect

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#14638"

@ntrel
Copy link
Contributor Author

ntrel commented Nov 13, 2022

OK so this triggers an error for dagon on buildkite for this line:

        for (auto i = ai_res.ai_addrlen; i > 0; --i, *dp++, *sp++)

The dereferences are useless, but I suppose that means the error needs to change to a deprecation.

ntrel added a commit to ntrel/dlib that referenced this pull request Nov 14, 2022
These will be deprecated once dlang/dmd#14638 is merged.
@RazvanN7
Copy link
Contributor

RazvanN7 commented Nov 15, 2022

The dereferences are useless, but I suppose that means the error needs to change to a deprecation.

Why do you say that *dp++ is useless? It certainly does have a side effect, it increments the value pointed at by dp. Why do you think that this should be disallowed?

Yeah, I thought that * had priority over ++. Looking at [1] I thought that priority 0 meant that it has the biggest precedence.

[1] https://wiki.dlang.org/Operator_precedence

@RazvanN7 RazvanN7 merged commit deb7c92 into dlang:master Nov 15, 2022
@ntrel ntrel deleted the for-inc branch November 16, 2022 10:34
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.

3 participants