Skip to content

Conversation

@jhogberg
Copy link
Contributor

This PR adds convenience types for expressing integers of a certain width and signedness, letting us remove ad-hoc definitions in various places.

@jhogberg jhogberg self-assigned this Nov 27, 2025
@jhogberg jhogberg added team:VM Assigned to OTP team VM enhancement labels Nov 27, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 27, 2025

CT Test Results

    5 files    252 suites   2h 6m 50s ⏱️
4 114 tests 4 010 ✅ 103 💤 1 ❌
5 251 runs  5 122 ✅ 128 💤 1 ❌

For more details on these failures, see this check.

Results for commit 8d3e421.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@jhogberg jhogberg force-pushed the john/erlang/uint-int-types branch from cf0fa2a to 8d3e421 Compare November 27, 2025 15:19
@michalmuskala
Copy link
Contributor

I'm not sure those types are particularly useful by themselves. There's nothing that guarantees any operation on an int(32) type will be within bounds - e.g. adding two int(32) can easily over- or underflow and exceed the range. This means the types are effectively only useful for literals and can't be easily enforced.

If we really wanted this, I think it should be paired with some sort of int module that supports fixed-size integer operations.

@jhogberg
Copy link
Contributor Author

Of course, this is just to standardize on a type instead of having lots of ad-hoc ones in socket, rand, etc.

@RaimoNiskanen
Copy link
Contributor

This is just a much more convenient and readable way to write for example -16#7FFF_FFFF..16#7FFF_FFFE as int(32) instead. It will really improve readability for many socket options in socket, as well as in many other modules that deal with protocols and interfacing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement team:VM Assigned to OTP team VM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants