what if...

1. When writing code, trust the compiler to do it's job optimizing it, and make the code more readable at the expense of low-level optimizations

2. compile it, read the disasm

3. if it turns out the compilet didn't do its job, fix the compiler

Follow

@wolf480pl Sometimes the language doesn't allow you to tell the compiler something you know that is required to do its job well. Examples in C{,++}:
- a value pointed to by a ref cannot change
- a ref cannot alias with a global,
- a parameter cannot alias with one other parameter, but can with another parameter,
- these two pointer do point into the same region, but they are manipulated in such a way that _they_ never point simultaneously at the same thing (or something similar that allows one to implement pointer chasing without spurious reads, like "this pointer is always ahead of that one") (you can't do this if you get such two pointers as function parameters),
- "I don't care about floating point addition not being associative" (-ffast-math and friends are an attempt to patch this, albeit in a very clunky way that can cause absurd errors sometimes).

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.