4 ms·
If the general public & tech community refers to C as a low level language then it is a low level language.
by lowken10 8y ago
If the general public & tech community refers to C as a low level language then it is a low level language.
- pjmlp 8y agoWhen a lie gets repeated enough times, eventually it becomes a fact.
- sametmax 8y agoIt's just practical. Otherwise how do you call java ? Or python ? And what would be the benefit of changing those particular sementics ? In french we define such article as "fucking a fly".
- mr_toad 8y agoJava and Python are much closer to C than C is to assembly. Managing memory and raw pointers are nothing. Try implementing a recursive function call in x86 assembler to get a real idea of low level.
- vardump 8y ago> Try implementing a recursive function call in x86 assembler to get a real idea of low level. Isn't that pretty easy? Recursion is just a function calling itself, directly or indirectly. Here's the simplest possible recursive function in x86 assembler. It simply causes a stack overflow. recursion: call recursion That's it. Tail recursive version would be simply a jump: recursion: jmp recursion Here's the simplest terminating version I could think of: recursion: dec eax jz rec_exit call recursion rec_exit: ret
- mr_toad 8y agoA call is not a function; functions have parameters and return values, and you’ll need at least one local variable. And you need to save the values of all the registers if you don’t want the called function overwriting them. You’ll need to manually push that all onto the stack with each call. There’s no compiler to do all that work for you.
- vardump 8y agoIf I have just one parameter in eax/rax and return value in eax/rax, why would I need a stack frame? It's not like any registers except eax/rax (and flags) are modified anyways. And that function doesn't call anything else that could modify eax/rax. A call is a function as long as caller and callee agree on the calling convention. Non-exported functions don't necessarily need to adhere to platform ABI. Generally you only push registers on stack when you need to modify more variables than what fit in your calling convention "thrashable" register set, or when you save register contents to call other function, or to push function call parameters on the stack. I do embedded systems & low level drivers as my dayjob. Not a stranger to writing assembler routines.