On Fri, Jun 21, 2024 at 10:40 AM Henry Bent <henry.r.bent(a)gmail.com> wrote:
Sure, and I don't disagree. I was just using an
old OS to make a point
about corner cases; it would be just as applicable if I had a modern OS
that for whatever reason lacked strdup(), or your personal favorite "but
everyone has this!" function. You're not going to be able to cover all
bases all the time, and I'm sure that there are plenty of code authors who
aren't interested in formally supporting anything outside of the most
common operating systems. If their autotools-based projects work on my
other OS that's great, but it isn't the fault of autotools if the project
isn't coded with my OS in mind.
Normally in modern software, "has it or not" is controlled by some
pre-processor variable you can check. The problem comes in when you have
under-conformant systems that claim conformance with POSiX 1-20xx, but that
lack that one interface mandated by it (and one that's not controlled by
some other thing... posix is super complex, for good and for ill). And you
also have the edge case of "newly defined in C11" say, and the base
compiler doesn't claim C11 conformance, but this function is none-the-less
available. It's really really hard to know if it's there or not w/o testing
for it. That even goes for "it's a linux box" since musl vs glibc has
variations that you won't know about until you check.
So it doesn't have to be something that should be as ubiquitous as strdup
to run into issues.
Warner