2 ms·
Mostly because mmap is not portable. If you're writing a Linux specific version of your code then mmap is fine. If you foresee running your code on other platfo
by Locke1689 17y ago
Mostly because mmap is not portable. If you're writing a Linux specific version of your code then mmap is fine. If you foresee running your code on other platforms then you shouldn't use it.
Basically, there's a reason why it's called "standard" IO. Generally you shouldn't use system calls unless you are absolutely, 100% sure that your code will only ever need to work on one system.
- holygoat 17y agoI've worked on a project that successfully uses memory mapping on all the major OSes. mmap is (allegedly) portable across Unixes: http://opengroup.org/onlinepubs/007908775/xsh/mmap.html http://opengroup.org/onlinepubs/007908775/xsh/mmap.html and you can do the same thing (with a few more hoops) on Windows.
- Locke1689 17y agoThere's no guarantee that it will be portable and act the same (even across the POSIX systems). I'm not saying you should never use it, just that it shouldn't your automatic answer to everything.
- kelnos 17y agoMany people may not care, but mmap() often doesn't exist on hardware without a MMU.