Hacker News new | ask | show | jobs
by 10ren 6025 days ago
C combines the power and performance of assembly language with the flexibility and ease-of-use of assembly language.

However, I was amazed to find that modern assembly language (since I was last in the game 25 years ago) has many high-level concepts in it (structures, loops, conditions etc), and looks... suspiciously... C-like.

But you're quite right about portability. Although C is famously not perfectly portable (int sizes, all those #defines - just some of the issues Java tackled), it is a hell of a lot more portable than an actual assembling language. :-)

1 comments

> (structures, loops, conditions etc), and looks... suspiciously... C-like.

Which assembly? All the ones I know of - especially the modern ones - have become even lower level over time, as compilers started liking more regularity over more powerful instructions.

From what I gather _machine code_ has become more low level, while _assemblers_ have adopted features from "high level" languages.

Not that I would know, the last time I wrote assembler it was for the Z80, and the last time I wrote machine code it was for the 6502.

The assembly language used by Sharc DSPs has an algebraic syntax rather than using all mnemonics, and loops are pretty easy to create as well (at least compared to x86 or, as my current project uses, PIC).
Can you give an example of a loop in an algebraic syntax please?

(All I can think of is CFG style, like "A -> (aA)?" oh, of course, there's also "a*" - still, it would be interesting to see an eg.)

I don't recall. Someone pointed out an example in a thread a while back.