← Back to context

Comment by lerno

7 days ago

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.