Comment on The C programming language is like debating a philosopher and Python is like debating someone who ate an edible

<- View Parent
squaresinger@lemmy.world ⁨1⁩ ⁨day⁩ ago

You also can understand everything in a system, at least some people can. I understand those people are rare and expensive to hire.

No. No, you seriously can’t, not even if you are deploying to one single PC. Your code includes libraries and frameworks. With some studying, you might be able to familiarize yourself to the point where you know every single flow through the frameworks and libraries down to each line that’s being executed. Then it goes through the compiler. Compiler building is an art unto itself. Maybe there are a handful of people who understand everything GCC does in the roughly 200MB of its source code. But lets say you are a super crack programmer, who can memorize source code with about as many characters as 42x all of the Harry Potter books.

Now your code gets executed by the OS. If you are on Windows: Sucks to be you, because it’s all closed source. All you can manage to understand is the documentation, unless you decompile all of Windows. If you are on Linux you at least have the source code. That’s only 300MB of source code, shouldn’t be hard to completely understand everything in there and keep it in memory, right? And you aren’t running your code directly on the bare Linux kernel, so please memorize everything your DE and other relevant components do.

But we aren’t done yet, we are just through the software part. Hardware is important too, since it might or might not implement everything exactly like in the documentation. So break out your hex editor and reverse-engineer the latest microcode update, to figure out how your CPU translates your x64 calls to whatever architecture your CPU uses internally. An architecture that, btw, doesn’t have any public documentation at all. Might be time to break out the old electron microscope and figure out what the 20 billion transistors are doing on your CPU.

Now we are done, right? Wrong. The CPU is only one component in your system. Now figure out how all other components work. Did you know that both your GPU and your network interface controller are running full embedded operating systems inside them? None of that is publicly documented or open source, so back to the electron microscope and reading binary code in encrypted update files.

If you think all this knowledge fits into a single human’s brain in a way that this human actually knows what all of these components do in any given circumstance, then I don’t really know what to say here.

It’s not a matter of skill. It’s just plain impossible. It is likely easier to memorize every book ever written.

One thing C really lacks is modern libraries to do these things. It’s not a limitation of C itself it’s just that most modern tools are targeted towards other languages. I understand that writing webapps in C isn’t the best idea because you don’t want web stuff running on hardware directly most of the time if you care about security anyways, but it’s really just a trend where the industry moved away from C with all of its frameworks and stuff which has not been good for the users.

You can write webapps in C using Webassembly. Nobody does it because it takes much more time and has basically no upsides.

Windows 98 was really good if you knew how it worked. I never had any issues really with stuff like XP. It always worked, it was always fast, it was always stable. I used XP for probably 10 years and never had any issues with instability and stuff and I was constantly modifying stuff, overclocking, patching drivers, modding bios, doing weird stuff that others didn’t do coming up with my own solutions. It worked really well. It’s modern windows that’s a buggy mess that crashes all the time.

I would recommend that you revisit these old OSes if you think that. Fire it up in a VM and use it for a few weeks or so. Nostalgia is a hell of a drug. I did run Win98 for a while to emulate games, and believe me, your memory doesn’t reflect reality.


Reading what you are writing about programming, may I ask about your experience? It sounds to me like you dabbled in a bit of hobby coding a while ago, is that right?

Because your assessments don’t really make much sense otherwise.

To get back to the other point though, to move away from C was a mistake. It’s not that much more complicated than using other languages. Most of the complexity was just in setting up the environment which was admittedly terrible under C. Trying to link libraries and stuff. The actual code itself is not really that much more difficult than say python, but it’s a different paradigm.

No, the problem was not setting up the environment. The main problem with C is that it doesn’t do memory management for you and thus you constantly have to deal with stuff like buffer overflows, memory management issues, memory leaks, pointer overflows and so on. If you try to write past a buffer in any modern language, either the compiler or the runtime will catch it and throw an error. You cannot write past e.g. the length of an array Java, Python or any other higher-level language like that. C/C++ will happily let you write straight across the stack or heap, no questions asked. This leads to C programs being incredibly vulnerable to fitting attacks or instabilities. That’s the main issue with C/C++.

and it’s not automatic that your code is going to be cross platform unless you use platform agnostic libraries. It’s entirely possible to write multiplatform code in C and most programs could be written in a multiplatform way if users use libraries that target multiplatform development and let users compile them ahead of time.

C is just as much “inherently multiplatform” as Python: Use pure C/Python without dependencies and your code is perfectly multi-platform. Include platform-specific dependencies and you are tied to a platform that supplies these dependencies. Simple as that. Same thing for every other language that isn’t specifically tied to a platform.

You could even have a standard in CPUs that would run any code to bootstrap a compiler and you could have platform agnostic binaries, which is just something that never happened because there was not really a point to it since so much code was written in lockdown .net and directx.

That standard exists, it’s called LLVM, and there are alternatives to that too. And there are enough platform agnostic binaries and stuff, but if you want to do platform-specific things (e.g. use a GPU or networking or threads or anything hardware- or OS-dependant) you need to do platform-specific stuff.

Python is a scripting language. It’s best used to call C libraries or to write very lightweight apps that don’t depend on low level hardware access. Java is like C but worse. JavaScript is like the worst of all worlds, strongly typed, verbose, picky about syntax, slow, interpreted, insecure, bloated, but it is cross platform which was originally probably why it was so popular. That should have just been added to C however. When you have code that runs 10x-10,000 times slower and you have bad programmers who don’t know how to write code that doesn’t destroy the bus, or use 100% of your system resources for no benefit, you end up in this mess we have today, for every app that uses 100% of your memory bandwidth, that halves the speed of the next program. If you have 3 programs running that peg then Emory bus, that means your next program is going to run at 0.25 the speed roughly. This is not how software should be written.

I don’t even know what kind of bus you are talking about. Emory bus is a bus line in Atlanta.

If you are talking about the PCIe bus, no worries, your python code is not hogging the PCIe bus or any other bus for that matter. It’s hard to even reply to this paragraph, since pretty much no single statement in there is based in fact.

The cool thing about C is you can use it like basic if you really want. With a bit more syntax, but you don’t have to use it with classes. You can just allocate memory on stack and heap and then delete all of it with like one class if you really want to. Everything that’s cool about other languages mostly just already exists in C.

You cannot use C with classes. That’s C++. C doesn’t have classes.

It’s kind of amazing to see the difference between a Linux smartphone and an android smartphone these days. A Linux smartphone running terrible hardware by today’s standard is just instant. 32 GBs of storage is enough to add everything you want to the operating systems because binaries are like 2 MB. Then that all goes away as soon as you open a web browser. A single website just kills it.

Hmm, nope. Linux smartphones run fast because they have no apps. Do a factory reset on your Android phone and disable all pre-installed apps. No matter what phone it is, it will run perfectly fast.

But if you run tons of apps with background processes, it will take performance.

Then you sit down on a modern windows machine and everything is slow and buggy as shit. It draws 500w of power on a 2nm process node. It’s a real issue. No amount of computer power will ever overcome interpreted languages because people will always do the minimum possible work to get it to run at an unstable 30 FPS and call it good.

I use Linux as my main OS, but I have Windows as a dual-boot system for rare cases. My PC draws 5w in idle on Windows or on Linux. The 500w what your PSU is rated for, or maybe what the PC can draw in full load with the GPU running at full speed (e.g. if you play a photo-realistic game), not what is used when the PC idles or just has a few hundred tabs in the browser open.

source
Sort:hotnewtop