← Back to context Comment by lerno 3 months ago What kind of conditional compilation are you missing? 15 comments lerno Reply spc476 3 months ago 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. lerno 3 months ago Oh, I think you missed something then:There is both `$if` and `$switch` compile time statements for this: https://c3-lang.org/generic-programming/compiletime/#if-and-...At the top level and `@if` attribute is used to achieve the same thing: https://c3-lang.org/language-common/attributes/#if owlstuffing 3 months ago Ah. The top-level lang description claims “No preprocessor”, but my definition of that word doesn’t appear to be the same as yours :/ 12 replies →
spc476 3 months ago 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. lerno 3 months ago Oh, I think you missed something then:There is both `$if` and `$switch` compile time statements for this: https://c3-lang.org/generic-programming/compiletime/#if-and-...At the top level and `@if` attribute is used to achieve the same thing: https://c3-lang.org/language-common/attributes/#if owlstuffing 3 months ago Ah. The top-level lang description claims “No preprocessor”, but my definition of that word doesn’t appear to be the same as yours :/ 12 replies →
lerno 3 months ago Oh, I think you missed something then:There is both `$if` and `$switch` compile time statements for this: https://c3-lang.org/generic-programming/compiletime/#if-and-...At the top level and `@if` attribute is used to achieve the same thing: https://c3-lang.org/language-common/attributes/#if owlstuffing 3 months ago Ah. The top-level lang description claims “No preprocessor”, but my definition of that word doesn’t appear to be the same as yours :/ 12 replies →
owlstuffing 3 months ago Ah. The top-level lang description claims “No preprocessor”, but my definition of that word doesn’t appear to be the same as yours :/ 12 replies →
For adapting code to different versions of libraries for one thing:
The sometimes annoyingly small differences between platforms.
Oh, I think you missed something then:
There is both `$if` and `$switch` compile time statements for this: https://c3-lang.org/generic-programming/compiletime/#if-and-...
At the top level and `@if` attribute is used to achieve the same thing: https://c3-lang.org/language-common/attributes/#if
Ah. The top-level lang description claims “No preprocessor”, but my definition of that word doesn’t appear to be the same as yours :/
12 replies →