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

Inconsistency between C interop type names #26837

Open
mppf opened this issue Mar 4, 2025 · 3 comments
Open

Inconsistency between C interop type names #26837

mppf opened this issue Mar 4, 2025 · 3 comments

Comments

@mppf
Copy link
Member

mppf commented Mar 4, 2025

Spin-off from #26828 (review)

In SysCTypes, we have c_intptr, c_uintptr and c_ptrdiff that all don't have the trailing _t. c_size_t and c_ssize_t are the only 2 that have the _t.

@mppf doesn't remember why it ended up this way. It might not have been intentional. If it was maybe it's that c_intptr is clear enough (we know int is a type) but c_size might sound like it means something else because size has many uses and isn't a type on its own in C. It looks like we've had this inconsistency at least since 2015.

Should we:

  1. Change c_intptr c_uintptr c_ptrdiff to c_intptr_t c_uintptr_t c_ptrdiff_t (and also c_wchar)
  2. Change c_size_t and c_ssize_t to c_size and c_ssize
  3. Do nothing about it
@arifthpe
Copy link
Contributor

arifthpe commented Mar 4, 2025

I'm in favor of 1 to consistently use the (c_ + C type name) convention. If this was something we did intentionally because the names are clear enough without _t, I still think the consistency is more valuable and there's not much benefit to leaving off the _t.

@bradcray
Copy link
Member

bradcray commented Mar 4, 2025

I tend to agree with @arifthpe here, though this it would've obviously been nicer if I'd noticed the inconsistency prior to 2.0.

I'll add that though consistency seems most attractive, I'm not sure I'd remove the _t from the c_[s]size_t tokens for the reason Michael gave in the OP. So, my ordered ranking would be:

  • prefix the C names for consistency/predicatbility
  • stick with the status quo
  • drop the _t from those types that have them

@jabraham17
Copy link
Member

I think I prefer option 1 the most. I agree with @arifthpe that the most useful metric here is consistency.

Noting that this topic came from #26828, which adds c_wchar[_t], and that it should also be consistent with whatever we do here.

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

No branches or pull requests

4 participants