3 ms·
I'd say it's just vastly different, and some rather basic assumptions C makes about the environment (basically that it's sorta kinda UNIX-y if you squint hard e
by Joker_vD 4y ago
I'd say it's just vastly different, and some rather basic assumptions C makes about the environment (basically that it's sorta kinda UNIX-y if you squint hard enough) simply don't hold.
You can still see the UNIX-centric point of view in stdlibs of other languages: I am particularly amused by Golang's "os" package. It's kinda-sorta supposed to be portable and OS- and platform-independent, but it's designed for POSIX-likes first which is why one has to pass 0666 or whatever as permissions when trying to open a file on Windows (even though it is completely ignored).
- salawat 4y ago>it's designed for POSIX-likes first which is why one has to pass 0666 or whatever as permissions when trying to open a file on Windows <Snicker> Well. That's amusing. So everytime one does file access through Go on a windows machine, one invokes the number of the Beast, eh? Apropos af if true. Also hilarious if it just by chance worked out that way.
- Joker_vD 4y agoWell, as I said, you can pass pretty much whatever, none of those bits (except the owner-writeable bit) do anything because Windows uses a fundamentally different model of access control. And no, Golang's os.Create() passes 0666 to os.OpenFile [0], just as fopen(3) passes 0666 to creat(2) [1] on Linux as well. [0] https://cs.opensource.google/go/go/+/refs/tags/go1.19:src/os/file.go;drc=b72a6a7b868deb5b671020c08fbf8d61ad8803d4;l=326 https://cs.opensource.google/go/go/+/refs/tags/go1.19:src/os... [1] https://linux.die.net/man/3/fopen https://linux.die.net/man/3/fopen