4 ms·
> Reading or writing to -1 in C is memory safe too. Is it? It's out of bounds of any object, and therefore undefined behavior.
by pcwalton 10y ago
> Reading or writing to -1 in C is memory safe too.
Is it? It's out of bounds of any object, and therefore undefined behavior.
- tedunangst 10y agoFile descriptor -1, as in the same thing we're unwrapping in the rust code. In C, if socket() returns -1, that's actually a monad that you can pass to bind() and listen() and accept() and then check for errors. :)