3 ms·
FreeBSD's implementation of FILE is a nice object-oriented structure which anyone could derive from. Super-easy to make FILE point to a memory buffer or some ot
by cjensen 1y ago
FreeBSD's implementation of FILE is a nice object-oriented structure which anyone could derive from. Super-easy to make FILE point to a memory buffer or some other user code. I used that a bunch a long time ago.
Obviously making FILE opaque completely breaks every program that used this feature, so no surprise it was reverted.
- seethedeaduu 1y agofopencookie, fmemopen, you don't need transparency.
- JdeBP 1y agoIn the FreeBSD case, far from breaking "every program" it breaks very little at all. In fact it broke 1 thing at the time. Unfortunately, that 1 thing happened to be sysinstall(8). stdin, stdout, and stderr were already pointers rather than array element addresses, and the external symbol references to __stdinp, __stdoutp, and __stderrp did not change; compiled code using the old macros continued to work as the actual structure layout was not changed; compiled code using FILE* would have continued to work as the pointer implementation didn't change; compiled C++ code with C++ function parameter overloading would have continued to link as the underlying struct type did not change; source code using the ferror_unlocked() and suchlike function-like macros would have not needed changing as there were already ferror_unlocked() and suchlike functions and those remained. Looking at things like https://reviews.freebsd.org/D4488 https://reviews.freebsd.org/D4488 from 2015 there was definitely stuff in the ports tree that would have broken back in 2008. But that won't break now should this change be made again, and that's not base. What actually broke was libftpio, a library that was in base up until 2011, and definitely won't break now, nearly 14 years after being removed for being orphaned after sysinstall(8) itself has gone away. * https://cgit.freebsd.org/src/commit/lib/libftpio?id=430f2c87214700ba8711ac0ca65701bf693c8ce8 https://cgit.freebsd.org/src/commit/lib/libftpio?id=430f2c87...