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

CCCL C: Size struct members should have consistent type size_t, alignment should use unsigned type #3960

Open
oleksandr-pavlyk opened this issue Feb 27, 2025 · 3 comments · May be fixed by #3978
Labels
CCCL-C For all items related to the C library

Comments

@oleksandr-pavlyk
Copy link
Contributor

Struct cccl_type_info defines size member to have type int (should be size_t), and aligntment to have type int, should be unsigned int instead.

Struct cccl_op_t defines size member to be of type int, as well as ltoir_size. Both should have type size_t. The alignment member should have type unsigned int.

Struct cccl_iterator_t defines size member to be of type int (should be size_t). Similarly, the alignment member should have type unsigned int.

@oleksandr-pavlyk
Copy link
Contributor Author

@shwina @leofang @NaderAlAwar @gevtushenko Any objections to the proposed change?

@leofang leofang added the CCCL-C For all items related to the C library label Feb 27, 2025
@gevtushenko
Copy link
Collaborator

Any objections to the proposed change?

No objections

@oleksandr-pavlyk
Copy link
Contributor Author

Actually, size members should have the type consistent with return type of sizeof(T), i.e., size_t.

Alignment members should be typed consistently with return type of alignof(T), i.e., size_t.

oleksandr-pavlyk added a commit to oleksandr-pavlyk/cccl that referenced this issue Mar 2, 2025
Size and alignment struct members must have same types as
return types of sizeof(T) and of alignof(T) respectively,
which are both `size_t`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCCL-C For all items related to the C library
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

3 participants