• azdle@news.idlestate.org
      link
      fedilink
      English
      arrow-up
      65
      arrow-down
      1
      ·
      5 months 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
        link
        fedilink
        English
        arrow-up
        26
        ·
        5 months 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
        link
        fedilink
        arrow-up
        4
        ·
        5 months 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
      link
      fedilink
      arrow-up
      31
      arrow-down
      1
      ·
      edit-2
      5 months ago

      To add on to @[email protected] '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
        link
        fedilink
        English
        arrow-up
        5
        ·
        5 months 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
          link
          fedilink
          arrow-up
          4
          ·
          5 months 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.

          • Cethin@lemmy.zip
            link
            fedilink
            English
            arrow-up
            4
            arrow-down
            1
            ·
            edit-2
            5 months ago

            I don’t think I said assembly is abstracted. It’s pretty much just a translation.

            Hexidecimal isn’t binary. They’re both just ways to represent numbers. A number displayed in hexadecimal and binary are the same number even though they look different. FF(base 16) = 1111 1111(base 2) = 255(base 10). They’re all identical.