A young chap playing All Star on the sharpest tool in his shed.
Terry Crews and a follow-up to his #metoo story
After reading this I wonder why other text editors don’t adopt Notepad’s architecture for opening files.
The only reason I can think of is that memory mapping files isn’t part of the standard, portable C/C++ APIs. If you want to memory map a file, you need to call an OS-specific API (CreateFileMapping() on Windows, mmap() on Unix and its clones), whereas most C/C++ programmers generally first think of calling fopen() or std::fstream as they are universal and portable across all OSes as part of the standard C/C++ libraries.
I, for one, love me some code riddled with stuff like
Back at my first job out of college, I had to work on a program that had to run on Windows, about a half dozen different versions of Unix, and even Unisys OS 2200. We didn’t want to #ifdef the crap out of our mainline code, so we ended up creating abstraction libraries that hid the various OS differences between each other, so we’d just call, for example, my_mmap() which would do the right thing to memory-map a file depending on the OS. Almost all the #ifdefs were relegated to this library, which made the mainline code much cleaner, and it would be my preference if working on anything portable that needs to use non-portable OS-level services.
Yeah, that’s kind of the obvious architecture. If a project isn’t even abstracting things away at that kind of basic level, then it’s either old legacy crap or being written by people with not enough experience.