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

Introduce enum evmc_bool #131

Closed
axic opened this issue Sep 3, 2018 · 4 comments
Closed

Introduce enum evmc_bool #131

axic opened this issue Sep 3, 2018 · 4 comments
Assignees

Comments

@axic
Copy link
Member

axic commented Sep 3, 2018

In https://github.com/ethereum/evmc/blob/master/include/evmc/evmc.h#L164 evmc_block_hash_fn returns 1 on success, 0 on failure.

Compared to that, evmc_status_code uses the POSIX style 0 for success, anything else for failure.

This kind of indicates an inconsistency. evmc_block_hash_fn tries to map a boolean into a uint, that's why.

A solution could be either using stdbool.h or creating an enum to replicate it: evmc_bool.

@chfast
Copy link
Member

chfast commented Sep 3, 2018

I considered this and I'm not convinced because I'm not sure we should introduce another bool type.

@axic
Copy link
Member Author

axic commented Sep 5, 2018

stdbool.h: http://pubs.opengroup.org/onlinepubs/009604499/basedefs/stdbool.h.html, not sure which C standard introduced it.

@axic
Copy link
Member Author

axic commented Sep 5, 2018

Should check stdbool.h with Go and rust-bindgen.

@chfast
Copy link
Member

chfast commented Sep 5, 2018

The stdbool.h is good for:

  • Visual Studio
  • Go
  • Python CFFI
  • Rust.

I will try this one.

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