8

Shamefully, after years of c++ hobbyism, I've only now discovered the ABSOLUTE BEAUTY of constexpr

I thought it was just the "new way of defining constants", so I always skipped over it as more of a basic utility than a hugely powerful part of c++

I didn't realize it could do comptime code! I can pre-compile huge arrays into my binary just like I could with comptime in zig.

Fuck me, I feel stupid as hell. More c++ rants to come, surely.

Comments
  • 3
    Oh yes, I love the compile time capabilities of C++.
  • 2
    Macros in Swift and Rust (not C++ though) take this even one step further.
  • 4
    Yeah C++ is crazy powerful -- and arcane :P
  • 2
    @Lensflare Zig was the first place I tried comptime code gen, and it was seamless. Completely wonderful, in fact. Barely any limits at all, you just write regular code (which *reasonably* can be comptime), denote the code and all of its inputs and outputs as comptime, and done.
  • 0
    @AlgoRythm Can zig do dynamic allocations in comptime?
  • 1
    @12bitfloat no idea frankly, all my comptime stuff is generally just lookup tables.
Add Comment