• Sonnenblume@discuss.tchncs.de
        link
        fedilink
        arrow-up
        0
        ·
        24 days ago

        If you have a constant expression like 1 + 2 in your code you can evaluate it at compile time once and avoid computing it at runtime. You can do that with control flow and much more complex language constructs in C++. If you want to know more about that look into C++ template meta programming, constexpr, and constval.

            • ඞmir@lemmy.ml
              link
              fedilink
              arrow-up
              0
              ·
              24 days ago

              I get that the designers wanted to have compile time static replacement but this was not the way to do it.