-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
v: add support for alignof
.
#24509
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
base: master
Are you sure you want to change the base?
v: add support for alignof
.
#24509
Conversation
Connected to Huly®: V_0.6-22877 |
Following this tip from CONTRIBUTING will helps you on next commits (it will do the
|
PR has been updated, can someone re-approve to run CI? |
You need to format the code use |
That wasn't it, I think the files should be already formatted through the setup Git pre-commit hook. I just had an unintended change in |
Summary
This PR adds support for the
alignof
builtin, allowing users to get the memory alignment (in bytes) of a type or expression.Highlights
New AST node:
AlignOf
Supports both
alignof(expr)
andalignof[Type]()
Integrated into:
Parser, checker, formatter (
v fmt
)C codegen (via
alignof(...)
+<stdalign.h>
)JS backend (placeholder for now)
Updated
docs.md
and changelogThis improves low-level memory control and brings
alignof
in line withsizeof
.I know this is missing tests, just want to make sure this is acceptable to add before I put more time into it.