Skip to content

[vm/ffi] Pointer<Null> #37362

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

Closed
dcharkes opened this issue Jun 25, 2019 · 4 comments
Closed

[vm/ffi] Pointer<Null> #37362

dcharkes opened this issue Jun 25, 2019 · 4 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi
Milestone

Comments

@dcharkes
Copy link
Contributor

What do we do with Pointer<Null> in the FFI? (This is allowed by the Dart language.)

@dcharkes dcharkes added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi labels Jun 25, 2019
@sjindel-google
Copy link
Contributor

This type could be useful for the nullptr constant, so that we don't need to cast it to use it in other contexts:

Pointer<Null> nullptr = Pointer<Null>.fromAddress(0);

// ...
void takesPtr(Pointer<Int8> ptr);
// ...

takesPtr(nullptr);  // Actually works!

@dcharkes
Copy link
Contributor Author

linking #35756

@sjindel-google
Copy link
Contributor

What needs to happen? AFAICT, everything is working as intended.

@dcharkes
Copy link
Contributor Author

We don't actually use Pointer<Null> as nullptr:

/// Represents a pointer into the native C memory.
final Pointer<Void> nullptr = Pointer.fromAddress(0);

If we can, we should change it to that maybe.

We don't have any tests containing Pointer<Null>, we should probably add one.

@dcharkes dcharkes added this to the D26 Release milestone Sep 30, 2019
@dcharkes dcharkes modified the milestone: D26 Release Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi
Projects
None yet
Development

No branches or pull requests

2 participants