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

Consistent handling of evmc_result #87

Closed
axic opened this issue Aug 26, 2018 · 2 comments
Closed

Consistent handling of evmc_result #87

axic opened this issue Aug 26, 2018 · 2 comments
Assignees

Comments

@axic
Copy link
Member

axic commented Aug 26, 2018

  1. evmc_execute_fn returns it as value
  2. evmc_call_fn expects a user specified pointer refering to it, to be filled
  3. evmc_release_result_fn expects a pointer to it, yet it

I assume 3. because you wanted it to behave like a C++ destructor.

It would be nice to:

  • evmc_call_fn to return the result struct as a value
  • evmc_release_result_fn not take a pointer, but a struct

Both these make it even more clear that evmc_result struct cannot be extended by the VM.

@chfast
Copy link
Member

chfast commented Aug 27, 2018

I had problems with returning structs with unions in Python so now every host function returning a struct mirrors C ABI. This is actually not so bad because now you can return an error like e.g. in evmc_blockhash().

For evmc_call_fn this could be a good change.
For evmc_release_result_fn it should be a pointer not to copy the whole struct.

@axic
Copy link
Member Author

axic commented Aug 27, 2018

For evmc_release_result_fn it should be a pointer not to copy the whole struct.

Good point, can you document this reason? Too bad C doesn't have reference syntax, would make this nicer.

Now I wonder if returning a pointer in all cases is better and let release handle it. That we could discuss as a separate thread.

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

2 participants