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

Fixes #10906 - Document range limits #10907

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

sdwheeler
Copy link
Contributor

@sdwheeler sdwheeler commented Feb 26, 2024

PR Summary

Document range limits

PR Checklist

  • Descriptive Title: This PR's title is a synopsis of the changes it proposes.
  • Summary: This PR's summary describes the scope and intent of the change.
  • Contributor's Guide: I have read the contributors guide.
  • Style: This PR adheres to the style guide.

Copy link
Contributor

Learn Build status updates of commit 5262c6d:

✅ Validation status: passed

File Status Preview URL Details
reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md ✅Succeeded View (powershell-5.1)
reference/7.2/Microsoft.PowerShell.Core/About/about_Operators.md ✅Succeeded View (powershell-7.2)
reference/7.3/Microsoft.PowerShell.Core/About/about_Operators.md ✅Succeeded View (powershell-7.3)
reference/7.4/Microsoft.PowerShell.Core/About/about_Operators.md ✅Succeeded View (powershell-7.4)
reference/7.5/Microsoft.PowerShell.Core/About/about_Operators.md ✅Succeeded View (powershell-7.5)

For more details, please refer to the build report.

For any questions, please:

@michaeltlombardi michaeltlombardi merged commit ea7c6e1 into MicrosoftDocs:main Feb 26, 2024
6 checks passed
enumeration for your start and end values.
evaluate to an integer or a character. The endpoints of the range must be
convertible to signed 32-bit integers (`[int32]`). Larger values cause an
error. Also, if the range is captured in an array, the count of resulting is
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the quick turnaround, but the word "numbers" is presumably missing after "count of resulting", and "the" is missing before "maximum size".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doh!

evaluate to an integer or a character. The endpoints of the range must be
convertible to signed 32-bit integers (`[int32]`). Larger values cause an
error. Also, if the range is captured in an array, the count of resulting is
limited to maximum size of an array in .NET, which is `[int]::MaxValue - 56`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I forgot to mention that this limit only applies to PowerShell (Core) / .NET (Core). In Windows PowerShell / .NET Framework, it is 256MB - 8 (268435448): E.g., (1..268435448).Count works (if you have the patience), whereas (1..268435449).Count fails.

@sdwheeler sdwheeler deleted the sdw-w216085-i10906 branch February 26, 2024 20:48
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.

Range operator (..): make it clear that integer endpoints refers to [int32], specifically
3 participants