DEV Community

Cover image for Is C still a high level language?
Swastik Baranwal
Swastik Baranwal

Posted on

Is C still a high level language?

I keep hearing that C is no longer a High Level Programming Language because it is no abstractions, has pointers, have to handle memory on our own, no string data type, unsafe etc.

Do you think that C is not a high level language anymore? I am against this because it's still readable as any other high level and usable as ever and has many libraries and still been updated.

Oldest comments (77)

Collapse
 
dorshinar profile image
Dor Shinar

Being high level or low level has nothing to do with it's readability. Higher level languages usually have GC and memory management, whereas low level languages do not.

Collapse
 
gwutama profile image
Galuh Utama

Well, when you have a CPU, the lowest programming language that most of us, mere mortals, can write for the CPU is assembler.

What C compiler does is none other than translating C syntax to assembler. It is still so low that In fact you can insert assembler snippets in C source code. There’s quite a lot of assembler code snippets in Linux kernel C source code.

So yeah, I think it’s pretty low level language because with C you can do almost everything that assembler can do and assembler is the lowest language you can write in.

Collapse
 
alohci profile image
Nicholas Stimpson

Yeah, that takes me back. That's real programming. Not like the namby-pamby memory managed languages I use these days.

Collapse
 
mindplay profile image
Rasmus Schultz

If this is sarcasm, it's a little too good 😂

Collapse
 
vtgandalf profile image
Valeri Todorov

That it's such a boomer thing to say. Both low and high level programming languages serve their purpose. It's true memory managed languages can be quite slow in execution time and can be resource hungry. On the other hand, you can use C# for example for almost everything and it's suitable for advanced design patterns that are just impossible to implement on C. Unless of course you write your own abstraction level, in which case congrats you just re created C++. Furthermore, C# can be optimized to run almost as fast as C and all executables can be stripped down to run even faster. For Gods sake even python can be optimized to run relatively fast. It all depends on the requirements and the context of the application.

Thread Thread
 
patryktech profile image
Patryk

For Gods sake even python can be optimized to run relatively fast.

And you can always write C modules that you then import into Python.

Collapse
 
craigmc08 profile image
Craig McIlwrath

Yeah, where have all the real programmers gone?

Thread Thread
 
alohci profile image
Nicholas Stimpson

Thanks very much for that link. A copy of same was posted up in the common-room when I was at Uni, and was in my thoughts when I posted my comment, which was, of course, tongue-very-firmly-in-cheek.

Collapse
 
type1j profile image
Jay Sistar

I agree with you for the most part, but that last paragraph is baseless.

I can insert assembler to Common Lisp and Rust. Both of those out match Python, Javascript, or C++ in abstraction power, so by definition, they are high languages. That doesn't mean that they can't reach down to lower levels of abstraction when they need to do so.

Collapse
 
pentacular profile image
pentacular

This is really not true at all.

A modern C compiler does quite a lot of interesting work to try to make C code competitive.

Things are reordered and elided and optimized in ways that are often surprising.

Consider what this does in C.

while (1);

If you think it requires the program to loop forever, you are mistaken. :)

Beyond that, there is a great deal that C cannot do which assembly can.

  1. C has no concept of registers (the register storage class just makes a variable unaddressable).

  2. C has no concept of op codes.

  3. C has no concept of the CPUs memory model -- C has a segmented memory model.

C programs run in the C Abstract Machine, and understanding this is essential to writing C programs that do not work only by accident.

Consider the following snippet -- what do you expect it to do in C?

{
  int i = 1;
  printf("%d, %d\n", i++, i);
}
Collapse
 
alohci profile image
Nicholas Stimpson

It's as much a high level language as it ever was.

Collapse
 
rsa profile image
Ranieri Althoff

As a generic syntax and semantic that can express any behavior desired succinctly to be translated into any assembly, be it x86, ARM or you name it, yes. I would consider "high-level language" to be analogous to "can be made to compile into any instruction set".

Collapse
 
aghost7 profile image
Jonathan Boudreau

Technically going by the definition, C could be considered high level. I don't really see how it makes a difference, at the end of the day C nowadays is only employed in niche use cases like embedded systems, kernels, drivers, etc. The reason why it is avoided is because it doesn't have many abstractions, i.e. it is considered too low level for general programming.

Collapse
 
vonheikemen profile image
Heiker

Depends on who you ask. Some people who only know languages like ruby or javascript could look at some C code and maybe think "I can do all of that in one line of [prefered language]". Maybe that's the reason why they think C is no longer high level.

Collapse
 
benwtrent profile image
Benjamin Trent

Depends on from which direction you are looking.

If you are looking from above (Javascript, Java, Python, etc.), it's low level.

If you are looking from below (machine code, assembly, etc.), it's high level.

itDepends

Collapse
 
masonjohnhawver42 profile image
Mason Hawver

So it's mid level or old high level.

Collapse
 
rtosman profile image
rtosman

Levels don't have ages.

Thread Thread
 
v4n5h4j profile image
v4n5h4j

Unless they are normalised.

Collapse
 
adegokekay profile image
Olukayode Adegoke

Ben,

I agree with your point of view - machine code and assembly are definitely lower level than C while Java, Javascript, Perl, and Python are higher level. I will say Pascal is at the same level as C.

-- Olu Adegoke

Collapse
 
benwtrent profile image
Benjamin Trent

I agree, Pascal (and probably Fortran) are on the same level as C.

Collapse
 
mxldevs profile image
MxL Devs • Edited

It's relative to what you're comparing to. I'd say it's lower level than some other languages, which is not a bad thing.

Arguably, one can consider most high level languages like Ruby, Python, Java, etc to be not that high level either because you still need to actually write instructions instead of just something more declarative and leaving the implementation up to the language.

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

You might be interested in 3GL and 4GL definitions. However it's somewhat outdated.

Collapse
 
ghison profile image
Beman Ghison (Behnam Ghiaseddin)

From 1 to 10, if we say assembly is number 1 and languages like Javascript and Python are number 10, then you can say C is about 7 (or maybe 6).

Collapse
 
aetelani profile image
Anssi Eteläniemi

Let's not forget the visual languages and DSL that are 10. I think Python and other so said high level languages are just unfortunate missteps of technology when quality and amount didn't not meet.