News for hackers. Stuff that matters.
Re:Modern C++ for C Programmers (2018) by habibur on Saturday July 24, 2021 @02:43AM (#27938958)
Because the underlying OS API expects a char* as file name.
Re:Modern C++ for C Programmers (2018) by nyberg on Saturday July 24, 2021 @05:40AM (#27939500)
Rather, the underlying OS requires an array of bytes terminated by 0 which can be hidden behind a decent API. The type being poor at expressing this is not a limitation of the OS but of the C type system. E.g in zig this would be `[*:0]u8` which is "a pointer to a region of memory of unknown length terminated by a 0 sentinel value". It's still a pointer but nothing says the type system can't track more state around it.
Re:Modern C++ for C Programmers (2018) by Animats on Saturday July 24, 2021 @02:15PM (#27943195)
So why isn't the Linux API properly encapsulated for C++? Rust does that.

C++ got off on a weird I/O direction. That

   file << item << item;
syntax never really caught on. Someone liked Currying too much.