# Talk:Low-level programming language

WikiProject Computing (Rated Start-class)
This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start  This article has been rated as Start-Class on the project's quality scale.

## Examples

This page could use some examples. Thehotelambush 16:09, 30 July 2007 (UTC)

Example - a function that calculates the nth Fibonacci number.
First, in C [3rd generation]:
unsigned int fib(unsigned int n)
{
if (n <= 0)
return 0;
else if (n <= 2)
return 1;
else {
int a,b,c;
a = 1;
b = 1;
while (1) {
c = a + b;
if (n <= 3) return c;
a = b;
b = c;
n--;
}
}
}

The same function, but converted to x86 assembly language, specifically MASM, using the __cdecl calling convention [2nd generation]:
fib:
mov edx, [esp+8]
cmp edx, 0
ja @f
mov eax, 0
ret

@@:
cmp edx, 2
ja @f
mov eax, 1
ret

@@:
push ebx
mov ebx, 1
mov ecx, 1

@@:
lea eax, [ebx+ecx]
cmp edx, 3
jbe @f
mov ebx, ecx
mov ecx, eax
dec edx
jmp @b

@@:
pop ebx
ret

Note:
@f refers to the closest following @@: label.
@b refers to the closest preceding @@: label.
I deliberately did not use proc.
And here is the final x86 machine code [1st generation]:
8B542408 83FA0077 06B80000 0000C383
FA027706 B8010000 00C353BB 01000000
B9010000 008D0419 83FA0376 078BD98B
C84AEBF1 5BC3

For comparison purposes, here is a disassembly listing:
00401000                    fib:
00401000 8B542408               mov     edx,[esp+8]
00401004 83FA00                 cmp     edx,0
00401007 7706                   ja      loc_0040100F
00401009 B800000000             mov     eax,0
0040100E C3                     ret
0040100F                    loc_0040100F:
0040100F 83FA02                 cmp     edx,2
00401012 7706                   ja      loc_0040101A
00401014 B801000000             mov     eax,1
00401019 C3                     ret
0040101A                    loc_0040101A:
0040101A 53                     push    ebx
0040101B BB01000000             mov     ebx,1
00401020 B901000000             mov     ecx,1
00401025                    loc_00401025:
00401025 8D0419                 lea     eax,[ecx+ebx]
00401028 83FA03                 cmp     edx,3
0040102B 7607                   jbe     loc_00401034
0040102D 8BD9                   mov     ebx,ecx
0040102F 8BC8                   mov     ecx,eax
00401031 4A                     dec     edx
00401032 EBF1                   jmp     loc_00401025
00401034                    loc_00401034:
00401034 5B                     pop     ebx
00401035 C3                     ret

Alksentrs (talk) 23:57, 16 February 2008 (UTC)

By the way, the Fibonacci sequence breaks at precisely F47.
unsigned int fib(unsigned int n): -1323752223
unsigned long long int fib(unsigned int n): 18446744072385799393
actual F47: 2971215073
Just thought I'd let you know. 174.28.41.236 (talk) 18:24, 2 January 2014 (UTC)

## Absolute terms

I've always known low-level and high-level programming languages to be absolute terms. The former refers to programming languages that provide no abstraction from the instructions that the processor implements, this is binary code (maybe written in hexadecimal), and assembler language, which is a mnemonic for the binary code and is assembled. The latter refers to programming languages that can be used independently of the processor because there is a software layer that abstracts that detail (something an assembler does not do), as a compiler or an interpreter.

The crisp and absolute difference between low-level programming languages and high-level programming languages, for what I knew, is that the code is done for a specific hardware (or group of them) as may be the x86 group of processors, or it is done for a software (or group of them) as is the group of C compilers.

Unfortunately I haven't been able to find references as this is more a terminological matter than a informatics matter, that's why I've required the citation (as there may be one). All that I got by now is this a definition in the webopedia[1].

Kind regards. —Preceding unsigned comment added by Trylks (talkcontribs) 23:26, 19 February 2008 (UTC)

## Removed two-year old citation tag

There are no controversial statements of fact in this article, so no citations are needed. Nor is the Utah State Office of Education reference needed. "a low level language is one that does not need a compiler or interpreter to run" is a simple statement of fact. "Mars is a planet" does not need an "according to..." reference. The article may be a stub, but what's there is an example of content which does not need references, besides the one instance with the citation tag. And sometimes, especially in the long-winded Wikipedia, a term can be explained perfectly well with a stub. J M Rice (talk) 13:37, 11 October 2008 (UTC)

## Old citation

It's rediculous to require a citation for the statement that programmers rarely code in machine code. That's like requiring a citation to state that Elvis is dead.

"Rediculous" or not, it's Wikipedia policy.Diego (talk) 10:26, 27 October 2008 (UTC)

## Low-level programming in high-level languages - needs edit, possible removal

I have moved the C example code out of this section and provided a point by point comparison between it and the assembly language example, to emphasise the difference between high level abstraction and low level architecture specifics. The C example served absolutely no purpose in this section - it is absolutely not an example of low-level programming in a high level language.

I do not think this section is very useful as currently written. It makes no mention of the most pertinent mechanism (inline assembler) and I think causes confustion by mostly refering to systems programming. Systems programming is not by definition low-level programming. UNIX (and UNIX-like) operating systems are written in C but almost all of that code is completely portable. Porting such an operating system to a specific architecture mostly means simply specifying values for operating system constants and in some places choosing implementations which will operate most efficiently on a particular architecture (over implementations which would function poorly but would work). Even those parts which are achitecture-specific are mostly high-level C code written with an awareness of the architecture rather than code which directly manipulates that architecture in a low-level way. Actual low-level programming is a very small part of operating system design. As it stands, this section is as vague in its worning and uncertain in its purpose.

I think this also applies to the "relative meaning" section, which seems equally ill informed. The beginning of the article gives a clear definition of "low level". This is computer-science jargon, where words and phrases which might be ambiguous in general language have specific meanings. Whoever wrote that doesn't realise that C is still considered a high level language. The emergence of more abstract languages hasn't changed that basic fact.

I am going to make the following changes to this section:

• Add mention of inline assembler and other techniques for low-level hardware control by high level programmes.
• Remove mention of Forth (off topic).
• Remove the paragraph which is entirely devoted to systems programming in C, does not contribute to the definition of Low-level programming languages and is off topic.
• Remove the small bullet list of other types of programmig languages. It is not relevant to this section, very limited and entirely redundant given the automatically-generated category-relevant lists at the bottom of the page.

Itsbruce (talk) 17:39, 25 August 2014 (UTC)