Conversation
104b62f to
b20057d
Compare
| switch (os.linux.getErrno(rc)) { | ||
| 0 => {}, | ||
| os.EINVAL => unreachable, | ||
| @intToEnum(os.linux.Errno, 0) => {}, |
There was a problem hiding this comment.
it seems clear to me that there should be a tag value of Errno which represents "no error" and has value 0.
There was a problem hiding this comment.
I thought that.... and then thought that getErrno returning an optional would work better: what do you think of that?
There was a problem hiding this comment.
I don't think that's the correct data layout. These ABIs have 0 as an in-bound value.
There was a problem hiding this comment.
Lacking that for now, #3806 could put 0 out of range, and hence make it so 0 is null
|
The problem: |
Fixes the assertion failure seen in ziglang#4233
|
@LemonBoy we need an extern enum because we want to have a duplicate value (e.g. alias EWOULDBLOCK to EAGAIN) |
Nobody said you cannot use an extern enum, you just have to use a correct type for the tag |
|
But we do want @enumToInt to produce a u12... |
|
We always want things we can't have... I think that matching the libcs by using a |
Fixes the assertion failure seen in #4233
|
@andrewrk what do you think?
|
5ab97ba to
20657a1
Compare
20657a1 to
b197ec7
Compare
|
Is there some tangible benefit from having the errno tag |
Has already saved me a few times:
|
You need a
Then use an unsigned tag type. |
I was.
Then we match neither linux ABI or libcs. |
Alright, that's a possible footgun.
The "linux ABI" for the syscall error codes states that they are |
|
I'm not necessarily saying "no" to this, but this pull request is not mergeable as is and doesn't appear to be on the path to that anytime soon. |
I don't think either of these are desirable language changes. I don't like the idea of bending the language over backwards to accommodate errno. |
Currently compiler is dieing with a segfault when I test locally.