4 ms·
C libraries can't be simultaneously as generic and as fast as equivalent C++ libraries without (or sometimes even with) the aforementioned "clunky macro hacks".
by zucker42 5y ago
C libraries can't be simultaneously as generic and as fast as equivalent C++ libraries without (or sometimes even with) the aforementioned "clunky macro hacks".
- lionkor 5y agoif "fast" was the only requirement we would be writing it in assembly
- rbanffy 5y agoIf fast were the only requirement, we’d have vastly different processor and memory architectures and we’d probably write in higher level languages with compilers that would also generate the optimal ISA to be compiled into architecture-specific microcode along with the binary that runs on it with enough information the OS can pick which part of the heterogeneous machine is best suited to run the program.
- tekknik 5y agoNo OS, it’s too slow. The binary needs to bootstrap the machine as well.
- tempodox 5y agoNope, folks didn't invent higher-level programming languages (the first of which was arguably Fortran, see case in point [1]) because they wanted their code to run slower. In fact, if “fast” is the most important requirement we'll probably write it in Fortran or C++. With C++ you just have to know which parts not to use. [1] Fortran Web Framework https://news.ycombinator.com/item?id=28509333 https://news.ycombinator.com/item?id=28509333
- zucker42 5y ago"Fast" is never the only requirement but often is a requirement. And the problem with a slow library is you don't know when rewriting the program to not use the library will be necessary to achieve the desired performance.