top | item 46919371

(no title)

jenadine | 24 days ago

> I am puzzled by the claim that C and assembly are not relatively close.

Did anyone say that? I think the point is not that it is not "close", but that C is not equivalent to ASM: C has its own abstractions, and there are things you can do on assembly that you can't express in C.

The other low level languages such as C++, Rust, Zig, ... are equally close since you can express the same things. In some respect they are even closer since they got more features builtins that modern assembly can now do that was not part of the design in C. (SIMD, threading, ...)

Modern languages also have extra abstractions that makes programming easier without compromising on the cost. There are more abstractions than in C, but they also are optional. (Just like you could use goto instead of while or for loop, but you're happy this abstractions exist. We could also use functions pointer in C++ instead of virtual functions, but why would we if the language provide tools that make programming easier, for the same result)

discuss

order

Nevermark|23 days ago

As I noted, closeness has several meanings.

> The other low level languages such as C++, Rust, Zig, ... are equally close since you can express the same things.

C is not just low level friendly, but low level out of the box. That is the level that all C must be written in, even when creating higher abstractions.

Some higher level languages are also low level friendly, not low level strict. Which is a kind dual.

I would argue that what makes C lower level, is that it comes in at, or under, the low levels of other languages, and its high bar comes in much lower than the abstractions built into other languages.

Forth is a good candidate for being even lower level.

But if someone else doesn't see things that way, that is fine. It is just one lens for comparing languages.

jenadine|23 days ago

> C is not just low level friendly, but low level out of the box. That is the level that all C must be written in

No, it is not:

- People use for/while loop, for example, instead of the "low level" 'goto'

- C compiler compute pointer aliasing, assume operations don't overflow, etc., in order to optimise your code: What you write doesn't translate directly to assembly.

- Some low level operations cannot even be represented in pure C (without using __asm__ extension escape hatch)