Hacker News new | ask | show | jobs
by xcombinator 6025 days ago
Thank god for this mistake, this mistake makes c what it is good at: at low level programming. It just pass directions between functions. Light and fast,no abstractions.

I love it, a way of making assembler like coding but multiplatform.

If I want high level programming I will program in another language but when you want machine control you have c without all the bloat.

2 comments

There would be little lost from having to specify &arr[0], rather than having array typed arr degrade into a pointer directly, but a huge amount to be gained - some very much needed help with tracking array sizes.
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. :-)

> (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.