we have pid_t and gid_t and uid_t but no fd_t

they're all ints why did fds get left out of the typedef club qwq
@navi we have errno_t as well and nobody uses it ever
@humm it's part of annex K iirc and things just don't implement annex K at all

but yeah returning errno_t instead of 'int' would be a lot better

@navi @humm Why do yall think that the multiplication of integer types is a good thing?

It's boilerplate, it makes the code less clear, it bloats header files, and if I need to serialize it I need to add a sysdep test to know what size it is. And the benefits of having specific integer types are dubious at best, I've never seen a strong argument for them.

What makes you want fd_t and errno_t over int or, if anything, int32_t?

@ska @humm

because it isn't any random int, it's a file descriptor, or an error, it has semantic meaning beyond the fact that it's represented by a number

you wouldn't do arithmetic with any of them, you wouldn't type a random literal to a function that takes a fd -- the fd represents and object, not a number by itself
@ska @humm


> It's boilerplate,
how? it's not like you're typing more, just, a different identifier

> it makes the code less clear
disagree, `copy_range(fd_t in, fd_t out, size_t size);` is a lot clearer to me than `copy_range(int fd_in, int fd_out, size_t size);`

> and if I need to serialize it I need to add a sysdep test to know what size it is
nothing stops it from being specified as an `int` under the hood, and otherwise, `sizeof()`?

@navi @humm I agree with almost everything here but if it's specified as an int under the hood, there's no reason for it not to be officially an int.

Boilerplate wasn't the right word; I rather mean burden of knowledge. Mental boilerplate.

Where I disagree is on our perception of clarity. copy_range(int fd_in, int fd_out, size_t size is clear enough to me, and doesn't burden the language with typedefs in order to say the same thing; documentation is obtained by clever use of (completely optional in a prototype) variable names.

Again, I think at this point it's just a question of taste.

@ska @humm

> Again, I think at this point it's just a question of taste.

i agree yeah
@navi @humm @ska Its nice if tab-completing the wrong variable result in "Error: xxx expected fd_t got errno_t"