547
you are viewing a single comment's thread
view the rest of the comments
[-] dmMeYourNudes@lemmynsfw.com 46 points 3 weeks ago

I am once again asking programmers to explain the joke

[-] azdle@news.idlestate.org 63 points 3 weeks ago

C was originally created as a "high-level" language, being more abstract (aka high-level) than the other languages at the time. But now it's basically considered very slightly more abstract than machine code when compared to the much higher level high-level languages we have today.

[-] Corbin@programming.dev 26 points 3 weeks ago

Other way around, actually; C was one of several languages proposed to model UNIX without having to write assembly on every line, and has steadily increased in abstraction. Today, C is specified relative to a high-level abstract machine and doesn't really resemble any modern processing units' capabilities.

Incidentally, coming to understand this is precisely what the OP meme is about.

[-] Ziglin@lemmy.world 4 points 3 weeks ago

I'd say much more highly abstracted than necessarily better (I know plenty of people who despise js and wouldn't call it better).

[-] FiniteBanjo@lemmy.today 30 points 3 weeks ago* (last edited 3 weeks ago)

To add on to @azdle@news.idlestate.org 's comment, "High Level" in terms of programming languages means further away from how the computer processes things and "Low Level" means very similar to how machines process things. For example, binary and hexadecimal (16 bit) machine code such as "assembly language" are both low level.

Imagine if program interpreters were building blocks, then 6 layers of abstraction would be very tall or higher level.

[-] Cethin@lemmy.zip 5 points 3 weeks ago

This is pedantic, but assembly languages get "assembled" to machine code. This is somewhat similar to higher level languages being "compiled," which eventually becomes assembly which gets assembled. The major reason why these are different is because a compiler changes the structure of the code. Assembly is a direct mapping to instructions. It just converts the text into machine code directly, which is why it's easy to go from machine code to assembly but decompiling doesn't give you identical results to the original source code.

Also, binary and hexadecimal are just different ways to view the same binary data and aren't different things. There is only "machine code" which is a type of binary data but you can view binary with any arbitrary base, though obviously powers of 2 work better.

[-] barsoap@lemm.ee 4 points 3 weeks ago

Assembly is a direct mapping to instructions. It just converts the text into machine code directly,

Kinda... yes and no? At least with x86 there's still things like encoding selection going on, there's not a 1:1 mapping between assembly syntax and opcodes.

Also assemblers, at least those meant for human consumption (mostly nasm nowadays) tend to have powerful macro systems. That's not assembly as such, of course.

But I think your "a compiler changes the structure of the code" thing is spot-on, an assembler will not reorder instructions, it won't do dead code elimination, but I think it's not really out of scope of an assembler to be able to do those things -- compilers weren't doing them for the longest time, either.

I think a clearer division would be that compilers deal with two sets of semantics: That of the source language, and that of the CPU. The CPU semantics don't say things like "result after overflow is undefined", that's C speaking, and compilers can use those differences to do all kind of shennanigans. With assemblers there's no such translation between different language semantics, it's always the CPU semantics.

this post was submitted on 22 Jun 2024
547 points (96.1% liked)

Programmer Humor

18388 readers
489 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS