High-Level vs. Assembly

A place where newbies can post without (much) fear of reprisal. All mission posts should still go in the applicable forum.
Forum rules
Older HTS users: Be nice to the new people.

NEW USERS: This is NOT the place to post about missions! Refer to "Missions" category.

High-Level vs. Assembly

Post by RatkinHHK on Sun Nov 30, 2014 11:23 am
([msg=85495]see High-Level vs. Assembly[/msg])

Quick question:

Is there anything you can program in Assembly Language that you can't program in a High-Level programming language like C?

I know that it is more difficult to program in Assembly and that it will only work on a certain CPU, and that you can write in C for a vast majority of computers, but is there a difference in what you can do, given enough knowledge of those programming languages? Feel free to correct me if I got something wrong...

Thanks in advance! [I should add this to my signature since a have a habit of saying it]
"You have enemies? Good. That means you've stood up for something, sometime in your life." --- Winston Churchill
User avatar
RatkinHHK
Experienced User
Experienced User
 
Posts: 72
Joined: Tue Nov 11, 2014 6:06 pm
Blog: View Blog (0)


Re: High-Level vs. Assembly

Post by F6Tech on Sun Nov 30, 2014 12:31 pm
([msg=85496]see Re: High-Level vs. Assembly[/msg])

I know when you write more complex programs such as operating systems, you have more capabilities than you have with C.
F6Tech
New User
New User
 
Posts: 22
Joined: Sun Nov 02, 2014 4:53 am
Blog: View Blog (0)


Re: High-Level vs. Assembly

Post by occamsrzr on Sun Nov 30, 2014 2:05 pm
([msg=85499]see Re: High-Level vs. Assembly[/msg])

>Is there anything you can program in Assembly Language that you can't program in a High-Level programming language like C?

Kinda....

A high-level language like C is actually more like an alias or short-hand for assembly, if you will.

The language is designed in such a fashion to refer to pre-written assembly routines in a compiler. This statement is grossly simplistic to so the least. But it's accurate.

So, really what your asking is; are there any routines, or sequence of assembly instruction that has not been implemented by a high-level language compiler like C?

Hypothetically, sure. That's way the continue to update languages and their compilers after all. I can't give you an example though. And in fact, the best example would be the list of new features to be included in the next iteration of a language, like C14 (C++ 2014)

But I suspect what you really mean is; "Is there an instance where something absolutely MUST be done in assembly?"

Not these days. In the past there way; BIOS firmware for example. But it wasn't so much that you COULDN'T do it in C so much as that it was just easier in assembly for a number of reasons. Those reasons don't tend to exist (at least that I know of) any longer.

But, I've not even a software developer, let alone one with enough experience in the industry to provide a few examples.
occamsrzr
Experienced User
Experienced User
 
Posts: 60
Joined: Wed Aug 24, 2011 10:28 pm
Blog: View Blog (0)


Re: High-Level vs. Assembly

Post by cyberdrain on Sun Nov 30, 2014 4:28 pm
([msg=85506]see Re: High-Level vs. Assembly[/msg])

occamsrzr wrote:But I suspect what you really mean is; "Is there an instance where something absolutely MUST be done in assembly?"
Not these days.

You're basically saying the in-line assembly option of C is useless. I'd say you're wrong. Sure, for most applications assembly and even C is being replaced by safer and easier languages, but there are still places where assembly is required.

Binary shellcode is almost exclusively written in assembly, there are embedded applications or parts of kernel design where it's a requirement and then there's reverse engineering and software cracking/DRM (yes, both sides) where it's used. I remember a similar discussion with e3cb about the uselessness of the goto statement, where he showed me that even that is still a requirement to save precious cycles in kernel programming (if I recall correctly).

Like the goto statement, while it has a very niche use, assembly is still used and probably always will be. It just depends on what you want to do and on which system.
Free your mind / Think clearly
User avatar
cyberdrain
Expert
Expert
 
Posts: 2160
Joined: Sun Nov 27, 2011 1:58 pm
Blog: View Blog (0)


Re: High-Level vs. Assembly

Post by centip3de on Mon Dec 01, 2014 2:07 pm
([msg=85542]see Re: High-Level vs. Assembly[/msg])

RatkinHHK wrote:Quick question:

Is there anything you can program in Assembly Language that you can't program in a High-Level programming language like C?

I know that it is more difficult to program in Assembly and that it will only work on a certain CPU, and that you can write in C for a vast majority of computers, but is there a difference in what you can do, given enough knowledge of those programming languages? Feel free to correct me if I got something wrong...

Thanks in advance! [I should add this to my signature since a have a habit of saying it]


Man, you really enjoy using the formatting tools.

But anyways, yes... sorta. Mainly kernel-related things (IRQ's, bootloader, etc.), and optimization related things (the C compiler can't optimize for super specific situations, but we can) require people to know/write-in ASM these days. Other than that, it's mainly hackery things that non-masochistic people use ASM for these days (shell-code, reverse engineering, ect.).

Also, if you want to write a new compiler (for a new language/CPU, etc.), then you have to know ASM.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook
User avatar
centip3de
Addict
Addict
 
Posts: 1479
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)



Return to NZone

Who is online

Users browsing this forum: No registered users and 0 guests