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

Refactor CSizedIntPointer class #88

Open
Berstanio opened this issue Dec 30, 2024 · 0 comments
Open

Refactor CSizedIntPointer class #88

Berstanio opened this issue Dec 30, 2024 · 0 comments
Assignees

Comments

@Berstanio
Copy link
Contributor

Berstanio commented Dec 30, 2024

That class is an atrocious abomination and belongs on a trash heap!
It is annoying to use, even more cumbersome to actually do something with it and it poisons the cleaness of other classes like PointerPointer and similar.
So it should be done better before an official release. 3.0.0 can be realesed, but the new jnigen binder/runtime should be marked as incubating.

The idea of that class is to bypass the different sizes of c int types that can arise with different compilers/architectures.
It currently does so by infering over the compiler the actual size of the type it is supposed to wrap.

I think a better approach is to have pointer types that are

  1. either variable size types like IntPointer and we make assumption of the size of an it per architecture. When compiling, we can statically assert that our assumption is correct.
  2. Have fixed size pointer like UInt64Pointer.

This should hopefully make the pointer easier to work with while retaining guarenteed correctness.

Furthermore, I'm tempted to make all Pointer types extend from VoidPointer.

Also, EnumPointer always assume an enum size of "int", which is incorrect.

@Berstanio Berstanio self-assigned this Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant