← Back to context

Comment by owlstuffing

7 days ago

Overall, this is one of the better C killers I’ve seen. But keeping macros while ditching conditional compilation? That seems completely backward to me. Oh well.

What kind of conditional compilation are you missing?

  • For adapting code to different versions of libraries for one thing:

        #if defined(__SunOS)
            presult = getprotobyname_r(proto,&result,tmp,sizeof(tmp));
            if (presult == NULL)
              return luaL_error(L,"protocol: %s",strerror(errno));
        #elif defined(__linux__)
            if (getprotobyname_r(proto,&result,tmp,sizeof(tmp),&presult) != 0)
              return luaL_error(L,"protocol: %s",strerror(errno));
        #else
            presult = getprotobyname(proto);
            if (presult == NULL)
              return luaL_error(L,"protocol: %s",strerror(errno));
            result = *presult;
        #endif
    

    The sometimes annoyingly small differences between platforms.