On Saturday, 23 July 2022 at 20:12:29 UTC, Walter Bright wrote:
>defined
doesn't work in D.
Sorry, I didn't think that I had to provide fully working example to illustrate an idea ;)
>The idea is to make the wrong way unattractive and clumsy enough that people will look for a better way, which we provide.
BTW, I've been through the zlib .h files, in the course of dogfooding it with ImportC. Every ugly practice I complain about with #if's is in full display there.
Here's another gem from your link:
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
# define HAVE_MEMCPY
#endif
It's just madness.
I totally understand you and your intentions with this. But I'd like to get your recommendation on the following situation. As a library developer I want to provide some SLA to the users: I guarantee that my library will be successfully built by all versions of all compilers (ldc,gdc,dmd) that are one year old or newer. The thing is that compilers evolve (they got new features, bug fixes etc) and I want my codebase evolve with them. I can easily check what compiler is used by version(DigitalMars)
e.g.. But how should I check that a specific feature is added to compiler/phobos or a specific bug is fixed?