News for hackers. Stuff that matters.
Re:The Wrong Abstraction (2016) by akkartik on Sunday May 09, 2021 @11:32AM (#27096801)
As a kind of extreme example, I've gone off and duplicated a whole computing stack because I think C is the wrong abstraction. For example, the way signed and unsigned numbers are defined in the C standard really over-complicates simple programs. We often don't care about portability in these days of instruction set monoculture.

Here's how I render the silhouette of the Mandelbrot set using fixed-point math on my computer. Each statement translates to a single x86 instruction. To detect overflow in a computation I don't perform more computation. I just use the processor's overflow flag, which C "abstracts" from me.

http://akkartik.github.io/mu/html/mandelbrot-fixed.mu.html

Main project page: https://github.com/akkartik/mu

Re:The Wrong Abstraction (2016) by slver on Sunday May 09, 2021 @03:08PM (#27098737)
> For example, the way signed and unsigned numbers are defined in the C standard

What do you mean?

Re:The Wrong Abstraction (2016) by MauranKilom on Sunday May 09, 2021 @03:13PM (#27098789)
Presumably something like the representation of signed numbers being implementation defined (instead of two's complement as is virtually always the case nowadays).
Re:The Wrong Abstraction (2016) by MaxBarraclough on Sunday May 09, 2021 @04:45PM (#27099554)
I know this doesn't address the point about the C standard itself, but:

• GCC and Clang both accept the -fwrapv argument, causing the compiler to guarantee that signed overflow will wrap, like in Java

• The latest C++ standard mandates that signed integer types use two's complement representation (signed overflow remains undefined behaviour)

Re:The Wrong Abstraction (2016) by akkartik on Sunday May 09, 2021 @03:15PM (#27098811)
Yeah. The standard avoids obvious guarantees because of some computer you never heard of. And then compiler writers use the standard as license to mess with the guarantee on _your_ computer.
Re:The Wrong Abstraction (2016) by akkartik on Sunday May 09, 2021 @03:13PM (#27098791)