Sane API design (AKA C's #ifdef hell)
H. S. Teoh
hsteoh at qfbox.info
Fri Apr 17 15:27:54 UTC 2026
On Fri, Apr 17, 2026 at 03:16:48PM +0000, Araq via Digitalmars-d wrote:
> On Thursday, 16 April 2026 at 23:59:53 UTC, H. S. Teoh wrote:
> > (The same argument can be made for code that overuse dynamic
> > binding, like heavily-OO code. Or in C, code that overuse function
> > pointers. The former is a little more manageable because there are
> > tools for working with OO; the latter can be really evil because the
> > func ptrs are ad hoc rather than following, say, a class hierarchy,
> > so they can literally point to *anything*. Good like figuring out
> > where your function calls are going when there's a bug.)
>
> Actually they can only point to prototype compatible functions and you
> can use an IDE/langserver to find out where the function pointers are
> assigned to. Or you use a debugger and inspect the callstack. Welcome
> to the world of tooling from the 90ies.
OO tooling is not perfect, but still better than home-grown ad hoc
functions pointers thrown together in C, trying really hard to imitate
OO but doing it really badly and on top of that having zero tooling
support.
T
--
Why ask rhetorical questions? -- JC
More information about the Digitalmars-d
mailing list