why isnt there some kind of a program where you write C-like code and it translates it to Assembly? Assembly is simple enough that it can be covered by pseudo-C code.
Why isnt there some kind of a program where you write C-like code and it translates it to Assembly...
What is gcc's -S flag?
gcc -S
>C-like code and it translates it to Assembly?
It's called C
That is literally what C is for.
nigga its literally C
Now that's a retarded question
Have you ever heard of this thing called "compiler"? They're pretty useful.
Why did you post this?
>code to assembly
That happens to every compiled languages
...
This belongs in "Sup Forums humour thread".
...
then why do people use assembly?
I asked this a while before and the answer was that humans can write more compact assembly code than compilers which i cant believe.
/thread
>Automated compiling is always better than the hands of a seasoned programmer with a good understanding of hardware and technique
Is this what you believe instead?
function call overhead, compilers used to suck (running on slow machines with limited memory, they couldn't/didn't do the optimizations found in modern compilers), not-quite optimal use of registers
back when clock speeds were single digit MHz, hand-optimized asm really mattered
in modern times, it's not nearly that important, and it's a lot harder to optimize code by hand better than a modern C compiler can
Microcontrollers and sheit.
- to write more efficient programs. With Compilers and Hardware becoming better and programmers becoming worse, this is rarely the case anymore. Example here might be Bleem!
- to access platform specific features that C wont let you access; writing to ports, switching between protected and real mode, modifying the interrupt descriptor table etc (mostly stuff you need when you write your own OS or very specific optimizations for small tasks)
- if you want to modify other software and need control over what registers your functions are modifying or rescuing. Game Trainers or No-Cd-Cracks come to mind
So this mofo could run on my toaster.
Most people don't, they just use C.
Few people do these days. You'd use it when talking to physical hardware especial in embedded work and in operating system kernels but most software is high level code. Even in operating system kernels a lot of the code will be in something high level like C but there might be inline assembly code for some time sensitive parts.
Compilers are usually good enough but for some things its preferable to look over the generated assembly code for any areas that the compiler couldn't optimize.
Sometimes the compiler gets stumped and it generates redundant code which can waste cycles and degrade performance a little. If you can read and write assembly you can correct these small mistakes.
Aside from what was already said in the thread the other main use of assembly these days is debugging.
the only reason I've found for using assembly or learning assembly is for reverse engineering. And even then it's used mostly in association with C code.
I don't think too many people waste the time to actually write out large programs in assembly.