Super HN

New Show
   Stdio(3) change: FILE is now opaque (OpenBSD) (undeadly.org)
Can someone elaborate? I always treated FILE as opaque, but never imagined people could poke into it?
The standard doesn't specify any serviceable parts, and I don't think there are any internals of the struct defined on Linux, at least not for musl libc. However, on OpenBSD, it did seem to have some user-visible bits:

https://github.com/openbsd/src/commit/b7f6c2eb760a2da367dd51...

If you expose it, someone will probably sooner or later use it, but probably not in any sane / portable code.

People use reflection for monkey patching and complain when using compiled languages less supportive of such approaches.

So it wouldn't surprise me, that a few folks would do some tricks with FILE internals.

However, who should really rely on internals of FILE? Isn't this a bad practice?
In general, it is a bad practice. However, it can be useful for some low-level libraries. For example, https://github.com/fmtlib/fmt provides a type-safe replacement for `printf` that can write directly to the FILE buffer providing comparable or better performance to native stdio.