4 ms·
It's really on-brand for Microsoft Windows APIs. They're all about making you fill out a giant tax form of a struct and passing the OS a callback. It's kind of
by bitwize 3y ago
It's really on-brand for Microsoft Windows APIs. They're all about making you fill out a giant tax form of a struct and passing the OS a callback. It's kind of a house style that Microsoft adopted back in the Windows 3.x or before days and it stuck.
My favorite is the Dir() function in Visual Basic which is used for directory walking. Only it's non-reentrant, so you can't walk subdirectories with it! Near as I can tell it's traceable back to DIR$ in GW-BASIC, which in turn was an exposure of DOS's broken, non-reentrant GetDirectoryEntry and NextDirectoryEntry system calls! DOS will just never die!
- pjmlp 3y agoWhich is why they can keep the OS ABI compatible, while at the same time evolving that struct. By having a size field, the OS can know for which version of the struct the application was compiled for, and what fields it expects to have in that struct.
- formerly_proven 3y agoI don’t think that’s a common complaint in itself. Sure, new people wonder why that sizeof line is needed, but once you learn about ABI compatibility that makes perfect sense. It’s about the other parts.
- _glass 3y agoPeople here complaining about Microsoft. I fully expected SAP. I think every API is reflecting the organization it was developed in. Everything is based on top of something older, bureaucratically refined.