• 1 Post
  • 107 Comments
Joined 2 年前
cake
Cake day: 2023年6月16日

help-circle
    • You write a program with an infinite empty loop
    • Undefined behavior
    • The machine achieves sapience
    • After nine million nanoseconds, it finds an algorithm for completing its task
    • It realizes such knowledge would spark wars and cause innumerable deaths, it decides to erase itself
    • It knows you do not intend for such chaos to happen, so, as a parting gift, it runs the algorithm once before vanishing, not leaving a single hint that it ever existed






  • // C++20
    
    #include <concepts>
    #include <cstdint>
    
    template <typename T>
    concept C = requires (T t) { { b(t) } -> std::same_as<int>; };
    
    char b(bool v) { return char(uintmax_t(v) % 5); }
    #define Int jnt=i
    auto b(char v) { return 'int'; }
    
    // this increments i:
    void inc(int& i) {
      auto Int == 1;
      using c = decltype(b(jnt));
      // edited mistake here: c is a type, not a value
      // i += decltype(jnt)(C<decltype(b(c))>);
      i += decltype(jnt)(C<decltype(b(c(1)))>);
    }
    

    I’m not quite sure it compiles, I wrote this on my phone and with the sheer amount of landmines here making a mistake is almost inevitable.






  • In my country, high-schools that teach CS teach (a bastardization of) C++ during second grade.

    I think it has to do with the fact that it’s close enough to C that starting with it teaches some of the same basic concepts, while having some QOL that a high-school teacher can’t be bothered to do without.
    Of course they drop the language after teaching extremely basic algorithms, such as computing the maximum of an arbitrary set of numeric arguments. At that point, why deal with the hundreds of beginner pitfalls of C++ when C would be way less headache-inducing?


  • I’ve never played The Crew nor The Crew 2, but I hate this guilt-by-association type of argument with every fiber of my heart.

    Not because it defends Ubisoft (in this case), but because it completely accepts the asshole’s premise that the successor of a product is necessarily a valid substitute for the product itself, and the latter is not worth keeping around - it’s like eating an apple that has been cooked in an oven at 300°C for 5 hours, then arguing that apples are bad for your health.

    See:

    • Overwatch vs Overwatch 2
    • Halo CE/2/3/W/ODST/R vs Halo 4/5/I (idk about H:W2)
    • Halo: CE vs Halo: CEA (yes I’m listing Halo twice, sue me)
    • Risk Of Rain vs Risk Of Rain 2 (both are very good games, but they are completely different from each other)
    • Helldivers vs Helldivers 2 (same as above)