News for hackers. Stuff that matters.
Re:“C is quirky, flawed, and an enormous success” – Dennis R... by xscott on Sunday July 09, 2023 @07:37AM (#36653641)
> Strict aliasing is one of the few tools we have to tell the compiler that aliasing will not occur.

I can see the argument, but there's a much better way to communicate to the compiler with your example:

    void f(int16_t* a, int32_t* b) {
      const int16_t a0 = a[0];
      for (int32_t i = 0; i < 100; i++) {
        b[i] = a0 + i;
      }
    }
Now a well defined compiler could do what you wanted.

I've seen other people suggest that UB is a mechanism to have these magical backdoor conversations to express optimization opportunities. I think that's absurd and reckless. Propose adding assertions or "declare" statements instead, and quit thinking of interpretive dance through a minefield as a method of communication.

Re:“C is quirky, flawed, and an enormous success” – Dennis R... by haberman on Sunday July 09, 2023 @10:57AM (#36654970)
You are entitled to your opinion. C isn't perfect, but as someone who spends my life trying to optimize the efficiency and code size of critical loops to the max, I like the direction C has gone with UB and optimizations. It's not the right tool for every problem, but for the most size/speed critical code it's hard to beat IMO.