Programming thread

the future is now, old man, [[noreturn]] is in the standard!
(its only 30 years until its not a compatibility concern)
I'm finally starting to see people move from C99 to C11, so I guess I'll be able to use stdckdint.h sometime around 2040. How exciting!
 
What tools and programming languages can I use on a modern Windows machine to ensure that the program I write is compatible even with something as ancient as Windows 98? I don't have anything particular in mind (though being able to create a program with a proper GUI would definitively up the cool factor), I am just asking out of sheer curiosity. Any real-world examples would be appreciated.
Don't bother with anything above visual c++ 6 (in a VM) if you're planning to go that low. My advice is to align your build tools to the minimum version of windows you are planning when it comes to pre XP/2000, otherwise you will just get utterly fucked. GUI wise you can use a very early and limited version of MFC or go the pure GDI route.

I can verify (before porting it to VS2022). We had a program which was built in 1997 which worked in windows 10.
 
Last edited:
rust troons need to realize that garbage collection won't freeze their 2d pixel platformer for 5 seconds at a time because this isn't the 1980s and garbage collectors can go really fast now
This isn't the 1980s and the primary memory management model of malloc and free (which garbage collection is built around) shouldn't be used anymore, Rust is also built around RAII which is also based around the concept of automating malloc and free and is also bad.

The garbage collector cannot understand your intentions and you can notice optimizations that it couldn't, this also isn't even just about processor speeds, if you don't have enough memory and go to allocate it and it isn't committed then you'll cause a page fault on the first write to each page and if you're using a garbage collector it'll probably try to delay committing memory as long as possible and freeing actively, which can also cause inconsistent performance because you don't know what the OS is doing or how busy it is. Freeing memory proactively is also what they generally try to do which means if you know you could reuse memory that generally won't happen, if you reach a bottleneck as well and you need to coerce the GC to perform better then good luck with that as well because they're usually designed to be invisible and give you very little control over them.

There's so many more things involved in garbage collection than just how fast processors can go, there's probably even more issues depending on how they manage GC in general which I honestly don't know that much about because I haven't looked into any of them in detail.
 
This isn't the 1980s and the primary memory management model of malloc and free (which garbage collection is built around) shouldn't be used anymore, Rust is also built around RAII which is also based around the concept of automating malloc and free and is also bad.

The garbage collector cannot understand your intentions and you can notice optimizations that it couldn't, this also isn't even just about processor speeds, if you don't have enough memory and go to allocate it and it isn't committed then you'll cause a page fault on the first write to each page and if you're using a garbage collector it'll probably try to delay committing memory as long as possible and freeing actively, which can also cause inconsistent performance because you don't know what the OS is doing or how busy it is. Freeing memory proactively is also what they generally try to do which means if you know you could reuse memory that generally won't happen, if you reach a bottleneck as well and you need to coerce the GC to perform better then good luck with that as well because they're usually designed to be invisible and give you very little control over them.

There's so many more things involved in garbage collection than just how fast processors can go, there's probably even more issues depending on how they manage GC in general which I honestly don't know that much about because I haven't looked into any of them in detail.
Based and arenapilled.
 
Then how do you propose we should manage memory?
Each process should be allocated a 640k chunk (that ought to be enough for anyone), and it should be up to the programmer to remember where things go, just like the good old days...

Is malloc-and-forget what the kids call idiomatic now?
Can't use-after-free if you never free!
 
The garbage collector cannot understand your intentions and you can notice optimizations that it couldn't, this also isn't even just about processor speeds, if you don't have enough memory and go to allocate it and it isn't committed then you'll cause a page fault on the first write to each page and if you're using a garbage collector it'll probably try to delay committing memory as long as possible and freeing actively, which can also cause inconsistent performance because you don't know what the OS is doing or how busy it is.
I only program for RTOS and use static allocations, I cannot handle all that non determinism (:_(
Freeing memory proactively is also what they generally try to do which means if you know you could reuse memory that generally won't happen, if you reach a bottleneck as well and you need to coerce the GC to perform better then good luck with that as well because they're usually designed to be invisible and give you very little control over them.
No one ever thought about it. Copying GCs? Nurseries? Nah, all bulshit.
This isn't the 1980s and the primary memory management model of malloc and free (which garbage collection is built around) shouldn't be used anymore, Rust is also built around RAII which is also based around the concept of automating malloc and free and is also bad.
RAII is almost the best way to manage any resource, not only memory. Probably only Linear Types can beat it, but I would have to learn more about them to argue about it.
It is in fact so good even GC languages try to reimplement it in limited way, be it using defer or with-resource blocks.
You can fight me on this.

I also prefer Scope-Bound Resource Management name for it.
 
Last edited:
In most cases, using shit like rust is overkill. Unless you're at the point of writing kernel-level stuff, the relative inefficiencies modern garbage collection (especially in the newer compiled langs) aren't something you will likely ever need to concern yourself with. It's like these trannies forget there are more ways to achieve memory safety than their gay-ass borrow checker.
 
This isn't the 1980s and the primary memory management model of malloc and free (which garbage collection is built around) shouldn't be used anymore, Rust is also built around RAII which is also based around the concept of automating malloc and free and is also bad.
I mentioned retards who think malloc/free are foundational about a month ago in this thread but didn't expect to see a literal example so soon. Nigger, almost no GC is built around malloc/free.
 
Maybe some 40 y/o Java saar will find this incoherent mess amusing.

As someone with a Webshitter/Python background, I am not unfamiliar with oop and was vaguely aware of the Spring Boot hate but after having escaped JavaScript framework hell, I now find myself in a new position that consists of roughly 80% enterprise Java with me having never written a single line of it before.

Today I was trying to test some endpoints of one of our microservices to write an OpenAPI spec and I realized I didn't even know how to start the fucking thing.
We went through the process with a different application last week but that was done and over with within minutes.

I open up fucking IntelliJ, do the hecking docker composerino and look at what's here already. The run configuration is already missing that was pre-configured in the other one so I'm looking into how to make that happen.
Turns out my "Project" doesn't even display all the actual files because I haven't right-clicked the right folder and made it "Sources Root" so I start comparing and copying settings from the other project. I can't even select the file inside the run configuration window even though I can literally see the file right there. I first have to designate the right arbitrary folder as a "module" so the Java classes inside are treated appropriately and the folder structure suddenly looks different. (Sure, why not?!)

Alright, I try to compile and run it. No luck, Spring Boot imports are missing. What? I thought this was already all Spring?! Takes me a second of research but I figure out the dependencies are nested somewhere in that awful mess of indistinguishable tags that is POM. I check for the spring-starter-parent one and it's already there? After further research, I learn I have to click the hidden "Resync Maven Projects" button to re-sync and dowload shit which it should do automatically but apparently doesn't sometimes lol. At last, dependencies are flooding in.

I hit the run button again. No luck. Something else is suddenly fucking missing. Squiqqly lines below the word "generated" inside a long string of dot notated objects. I don't have the slightest clue where the hell they are supposed to come from. I scramble through the codebase trying to abstract things in a way where I can compare it to concepts I am familiar with but no use.
I notice that there is a target folder in the source directory so obviously something must have happened at some point?! Inside, there is a folder..."generated-sources". Awesome.
It's essentially just models. But it's clearly incomplete. The whole thing crashes 2 seconds after running every time. So, through sheer luck I see another arbitrary button literally labeled "Generate Sources And Update Folders". I click it and it does I what I hoped it would do.

Ok. I try to run it all again and it doesn't immediately crash. But it crashes soon after. This time, Kubernetes errors. I'm trying to run it locally so it's obviously complaining about a namespace. More googling, trying to find a way to forcefully indicate that it's not running inside a cluster, I just want to run this fucking Spring Boot program. I find an appropriate property I can apparently set in a bootstrap.properties file. One of which is present in the test directory but not the main one. So I just copy it over including the configuration to disable Kubernetes.

And I try my luck again. We're getting closer. Next error. (At which point I stopped trying to understand the problem.) Apparently one particular font that was moved somewhere is..."not a valid font". No problem. I go inside the deeply nested directory structure and find a few .ttf files except they're not actually .ttf files. It's just a git api url and some hash. What in the fuck?
So now I had to learn what the hell Git LFS was. Not too complicated, I guess. I wanted to see if there was something wrong with the font it was getting so I looked up a git command that would pull the file except it replaced all these LFS files with the actual font files. Not entirely unexpected. But no way this would run anymore after that. And the font turns out to be just a normal damn font like the others.

Readying up to throw in the towel and asking someone, I run the application one last time. And...it's not crashing!!!! It is throwing a lot of errors about missing files for 2 minues or so before automatically restarting but it's not crashing and, even better, I can make requests to the API endpoints. Retarded perseverance triumphed today. Felt pretty good but seriously I need to learn Java.
 
A lot of my time spent, back when I was learning how to program initially, was on learning Java; and as someone who spent most of their time programming in java and python, I always liked how I could split off a class and its constituent methods into a file if I felt it got too big for the first file or whatnot. Does C have something similar? I know it has header files, but I don't think those are quite the same...
 
  • Thunk-Provoking
Reactions: Evil Whitey
A lot of my time spent, back when I was learning how to program initially, was on learning Java; and as someone who spent most of their time programming in java and python, I always liked how I could split off a class and its constituent methods into a file if I felt it got too big for the first file or whatnot. Does C have something similar? I know it has header files, but I don't think those are quite the same...

I only know very little C from playing around with it every now and then but how are header files not the same? I mean, at the end of the day, can both be just abstractions for the purpose of modularity. If you felt like it, you could have separate .c and .h pairs for each struct that should have method binding out of the box, and then you'd have something similar to a Java class file structure, minus things like inheritance maybe. But you could manually write that yourself in C. Could theoretically write everything in C but then you would just recreate Java. Bleak.
 
  • Like
Reactions: Evil Whitey
alloca(), it's the ONLY SAFE memory management. Allocating bytes? Passing pointers? Psshh naw.
I can't believe I've never read about this, it would be ideal for the temporary string buffers you often see popping up
 
I always liked how I could split off a class and its constituent methods into a file if I felt it got too big for the first file or whatnot. Does C have something similar? I know it has header files, but I don't think those are quite the same...
There's a lot you can do. Header files just contain prototypes to code implemented elsewhere. You split your functions into files according to whatever taxonomy. There's a bit of boilerplate to write, function prototypes in header files, but it's trivial. You could, in theory, even #include every code file in one, and build exactly one file. Combined with the preprocessor, there is a LOT of fun potential for HACKS. C can do modularization in ways Java can't, on the basis of its preprocessor macros.

Code:
#define OBJ(object,method,...) (*object)->method(object,##__VA_ARGS__)

This little gem lets you write OBJ(object,method,params) instead of (*object)->method(object,params) and save yourself from repeating the object. You can use C++ objects almost as easily as from C++.
 
Back