News for hackers. Stuff that matters.
Re:Metaprogramming custom control structures in C (2012) by ludamad on Saturday July 10, 2021 @02:37PM (#27795466)
I'm curious about how much easier it is to optimize compiler time for macros rather than templates here. In theory they wouldn't be all that different, but in practice it doesn't seem so
Re:Metaprogramming custom control structures in C (2012) by glouwbug on Saturday July 10, 2021 @04:26PM (#27796187)
CTL just copy pastes a bunch of code via an include for each new type. The following two tidbits are basically the same thing:

CTL

    #define P 
    #define T int
    #include <vec.h>
STL

    #include <vector>
    template class std::vector<int>;
C++ with its STL is just dramatically slower at compiling it all. C loves to chew through its basic syntax and O(1) lookup since every symbol is essentially unique (take that C++ and your function overloading!)