Hacker News new | ask | show | jobs
by 12_throw_away 87 days ago
I'm like 3 sentences in and already things do not quite make sense.

> Calling [socket] operations in the wrong order [...] is undefined behaviour in C.

UB? For using a socket incorrectly? You sure about that?

> Documentation — trust the programmer to read the man page (C, Rust).

I'm sorry, are they saying that rust's socket interface is unsound? Looks to me like it's a pretty standard Rust-style safe interface [1], what am I missing?

[1] https://doc.rust-lang.org/std/net/struct.TcpListener.html

2 comments

The C standard doesn't have anything to say about sockets at all, so not like it's defined to use them even in the right order.
They say “undefined behaviour”. They mean “returns an error”, or “can return an error”.