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

GLFW type incompatibility (boolean / integer) #3442

Open
veigaribo opened this issue Apr 17, 2024 · 0 comments
Open

GLFW type incompatibility (boolean / integer) #3442

veigaribo opened this issue Apr 17, 2024 · 0 comments

Comments

@veigaribo
Copy link

Context

Trying the language out for the first time right now.

  • Operating System & Odin Version:
  • Please paste odin report output:
Odin:    dev-2024-04-nightly:aab122ede
OS:      Arch Linux, Linux 6.8.2-arch2-1
CPU:     AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx
RAM:     17862 MiB
Backend: LLVM 17.0.6

Expected Behavior

glfw.TRUE and glfw.FALSE should both be acceptable as the third parameter of glfw.SetInputMode

Current Behavior

Since glfw.TRUE is defined as true and glfw.FALSE as false

TRUE :: true
FALSE :: false

(booleans) instead of 1 and 0 (integers), as they are in C (https://www.glfw.org/docs/latest/group__init.html#ga2744fbb29b5631bb28802dbe0cf36eba), they are not valid as arguments for glfw.SetInputMode (https://pkg.odin-lang.org/vendor/glfw/bindings/#SetInputModei32s) — but should be: https://www.glfw.org/docs/latest/group__input.html#gaa92336e173da9c8834558b54ee80563b

If the mode is GLFW_STICKY_KEYS, the value must be either GLFW_TRUE to enable sticky keys, or GLFW_FALSE to disable it.
...
If the mode is GLFW_STICKY_MOUSE_BUTTONS, the value must be either GLFW_TRUE to enable sticky mouse buttons, or GLFW_FALSE to disable it.
...

Failure Information (for bugs)

Design issue

Steps to Reproduce

Design issue

Failure Logs

Cannot convert 'glfw.TRUE' to 'i32' from 'untyped bool', got true
Cannot convert 'glfw.FALSE' to 'i32' from 'untyped bool', got false


My opinion: I really don't like the idea of trying to have the exact same API in C and Odin. This is a clear case where the language semantics make the two incompatible. But I'm sure I'm not the first one to bring this up

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