4 ms·
This is wrong. It belongs in the linker and you can pull the symbol it creates in with extern. I’ve been doing this for about 25 years.
by iasay 4y ago
This is wrong.
It belongs in the linker and you can pull the symbol it creates in with extern. I’ve been doing this for about 25 years.
- dafelst 4y ago...and now your solution is non-portable and as a cross-platform developer you need to implement N different build scripts. This is far more elegant.
- iasay 4y agoNo C toolchain is portable! If that's a problem, use Go or another higher level language.
- xigoi 4y agoIsn't one of the supposed advantages of C that it works on many platforms?
- iasay 4y agoThe last 40 odd years have proven that it does work but what you write isn’t portable.
- iainmerrick 4y agoThat’s not the case, if you take a bit of care. Look at STB for example (https://github.com/nothings/stb https://github.com/nothings/stb) -- I’ve successfully used STB functions on a bunch of different platforms. In both C and C++, even!
- iasay 4y agoAh yes the “if you take a bit of care” argument. Welcome to the 1% of C programmers club :)
- jcelerier 4y agoI guess the programs that I write which work on Mac / Windows / Linux / Wasm / i686 / amd64 / armv7 / aarch64 are just a bad dream I had
- iasay 4y agoOnly because you know the platform specific nuances...