The Programming Thread

Discussion in 'Miscellaneous' started by MoreMoople, Mar 19, 2020.

?

Do you program?

Yes, all the time! 11 vote(s) 22.4%
Yes, sometimes :) 18 vote(s) 36.7%
Yes, but just for fun :D 5 vote(s) 10.2%
I tried it once... 9 vote(s) 18.4%
Nope. Nope. Nopity Nope nope. 4 vote(s) 8.2%
I don't, but I would like to :) 2 vote(s) 4.1%
  1. You missed the "" and the semicolon in your string initialisation, you also didn't make the array long enough to fit the NULL terminator character at the end.
    Code:
    char language[] = "C code";
    
    Assembly is still incredibly relevant because it's the language of the CPU (but in words not binary; it can be translated directly to binary). A compiler will turn your higher level language like C into assembly, then into machine code. On particular projects too, it can be advantageous to use assembly over some compiled language because you get access to particular instructions or you can be 100% sure what instructions will be run (a compiler hides that unless you look at the compiled output).
  2. I think this is a weak argument, to be honest. It is easily translated to machine code, and it always will be, but if nobody uses it except for toy or retro projects, it is not relevant anymore, I would say.
    Although I guess then I would also have to say Latin is not relevant anymore... and I'm not sure if I am fine with that. :p
    What I wondered though, is if assembly language is actually used in businesses.
  3. Assembly is absolutely used in business, but like any language or tool it has its specific advantages. I use it in projects all the time because I work mostly with embedded devices, where I've got no operating system, limited memory, and want to access particular parts of the instruction set (DSP instructions in particular). Sometimes it's easier to write out the specific set of instructions, rather than compile it down from C. Or if you want to be 100% control over what the CPU does and when it does it, assembly is the only way.

    Additionally, every different type of CPU has its own peculiarities, so any cross platform program (such an operating system) has to have parts of it written in assembly such that you can achieve a desired result. The boot process of a computer or OS, where the memory is allocated and started along with other CPU features is just more easily done in assembly.

    And in the case where a higher level language is compiled down to machine code, it's often useful for debugging to have an understanding of what the code is actually doing, what the CPU is executing. It's necessary to translate the machine code into a more easily understandable format (assembly).
    607 and MoreMoople like this.