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

Add bit_set to core:sys/posix with all OS types that should be POSIX compliant #4929

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RaphGL
Copy link

@RaphGL RaphGL commented Mar 12, 2025

I've been writing a library and I needed to conditionally compile a function so if the OS was POSIX I could do a syscall otherwise provide a fallback.

With this bit_set I could do this:

when ODIN_OS in posix.ALL_VALID_OS_TYPES {
    my_func :: proc() { /* do something */ }
} else {
    my_func :: proc() { /* do something */ }
}

@laytan
Copy link
Collaborator

laytan commented Mar 13, 2025

This should probably just be solved like we do in core:thread and core:time among others, where we have an IS_SUPPORTED constant that is true or false based on the OS. Your code would then be when posix.IS_SUPPORTED {

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

Successfully merging this pull request may close these issues.

2 participants