Skip to content

Conversation

salpelter
Copy link
Contributor

@salpelter salpelter commented Aug 27, 2024

Summary

It's basically a code example that has a wrong output comment in the end. The number in question (10653) is actually of type long, which makes it a signed 64-bit integer, not 32.

@salpelter salpelter requested a review from a team as a code owner August 27, 2024 19:10
@ghost ghost added the area-System.Runtime label Aug 27, 2024
@salpelter salpelter changed the title Fix an error in the output comment Fix a mistake in the output comment Aug 27, 2024
@salpelter salpelter changed the title Fix a mistake in the output comment Fix a error in the output comment Aug 27, 2024
Copy link

Learn Build status updates of commit 76fa54e:

✅ Validation status: passed

File Status Preview URL Details
snippets/csharp/System/Object/GetType/GetTypeEx2.cs ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Aug 27, 2024
@BillWagner
Copy link
Member

BillWagner commented Aug 28, 2024

Hi @salpelter

I'm closing this because the original code is correct. The declaration casts the type of 10653 to a long. Therefore, it's type is long, even though its value is small enough for a 32 bit int. See sharplab

@BillWagner BillWagner closed this Aug 28, 2024
@salpelter
Copy link
Contributor Author

salpelter commented Aug 28, 2024

Hi @salpelter

I'm closing this because the original code is correct. The declaration casts the type of 10653 to a long. Therefore, it's type is long, even though its value is small enough for a 32 bit int. See sharplab

I don't understand what you're trying to say, to be honest. I never said that the number isn't of type long. And I agree that the number is small enough for a 32-bit integer, but since it was cast to long, that makes it 64-bit, doesn't it?

I followed your sharplab link and it only confirmed that I was right. It literally displayed "10653 is a 64-bit integer," as I expected. Am I missing something? It didn't even cross my mind at the time of making the pull request that my edit was in any way incorrect. Could you please explain what's wrong?

@salpelter salpelter changed the title Fix a error in the output comment Fix an error in the output comment Aug 28, 2024
@gewarren gewarren reopened this Aug 28, 2024
Copy link
Contributor

@gewarren gewarren left a comment

Choose a reason for hiding this comment

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

Thank you @salpelter!

@gewarren gewarren enabled auto-merge (squash) August 28, 2024 17:37
Copy link

Learn Build status updates of commit 76fa54e:

✅ Validation status: passed

File Status Preview URL Details
snippets/csharp/System/Object/GetType/GetTypeEx2.cs ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@gewarren gewarren merged commit f53f53c into dotnet:main Aug 28, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Runtime community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants