STOP DOING #MMAP!

• Files were not supposed to be treated like memory.
• Years of mmaping, yet no real-world use found for giving disk data memory addresses.
• Wanted to have a file in memory anyway, for a laugh? We had a tool for that, it was called "reading into a buffer".
• "Yes, please give me a SIGBUS when I run out of space. Please give me a SIGSEGV if I read past the file." — statements dreamed up by the utterly deranged.

#C #ProgrammersHumor

@mgorny

I love reading into butter. Margarine just isn't the same. šŸ˜‚

@mgorny

Ah, you've edited that out now. šŸ˜‚

@amin, yeah, I loved that typo but it kinda distracts. Gave it a separate toot.

@mgorny

Ahaha, I missed the update toot. I see it now ;)

@mgorny yeah, mmap has it's kinks, but reducing file ops down to a pointer is handy for some tasks. Do you see problems other then signals?
@radon, besides people thinking it a great idea to cast file data to struct pointers?
@mgorny those same people can do seek and read and mishandle the char* in the same way.
@mgorny I’m not sure I understand why MMAP is bad? Why is mapping file contents to address space any worse than copying the contents to a buffer?
@cylrs, because it doesn't provide good error handing, so programs crash in the most horrible ways instead of trying to recover.