Programming thread

  • Want to keep track of this thread?
    Accounts can bookmark posts, watch threads for updates, and jump back to where you stopped reading.
    Create account
Translation: I am a fucking retard that can't understand the value of automating the release of resources (memory, file handles, mutexes, etc) when exiting scope.

Translation: I am the actual fucking retard that doesn't understand that resources don't need to be acquired and released 1,000 times every second, slowing down my entire fucking program by a factor of 10, just because I am too much of an ignorant faggot to learn how to manage memory in non-idiotic ways such as not releasing it every single fucking time scope changes
 
Translation: I am the actual fucking retard that doesn't understand that resources don't need to be acquired and released 1,000 times every second, slowing down my entire fucking program by a factor of 10, just because I am too much of an ignorant faggot to learn how to manage memory in non-idiotic ways such as not releasing it every single fucking time scope changes
The performance problem you are describing has more to do with program structure than anything RAII specific.
 
Translation: I am the actual fucking retard that doesn't understand that resources don't need to be acquired and released 1,000 times every second, slowing down my entire fucking program by a factor of 10, just because I am too much of an ignorant faggot to learn how to manage memory in non-idiotic ways such as not releasing it every single fucking time scope changes
Bro watched one Muratori video on RAII and thinks that RAII = smart pointers.
 
Translation: I am the actual fucking retard that doesn't understand that resources don't need to be acquired and released 1,000 times every second, slowing down my entire fucking program by a factor of 10, just because I am too much of an ignorant faggot to learn how to manage memory in non-idiotic ways such as not releasing it every single fucking time scope changes
So pull the resource acquisition up the levels until its outside of the hot loop? You can pass ressources into functions, you know?
 
Jesus fucking christ. unless any of you codemonkeys and skids have created the type of software I've created from scratch, shut the actual fuck up. I've reverse engineered mobile apps, hacked video games, built a phone farm that I could remotely control from a central hub and inject commands into hundreds of devices with a single click. You fuckers have used javascript frameworks. Shut. the. fuck. up.
The fuck did you say to me you little bitch? I'll have you know I'm trained in gorilla programming and have over 300 confirmed hacks...

lmao, no RAII
Translation: I am deeply afraid of memory, so never learned how to manage it
Translation: I am deeply afraid of assembly, but I want to pretend that I am better than everyone else, so I'm going to pretend that C is low level

RAII is memory management; C++ automatically calling certian functions for you is a convenience to make things less tedious, just as C handles function calls and the stack, or how malloc/free actually do the hard work for you. There is a great benefit to reducing the amount of noise that the programmer has to deal with. Just becuase some people don't know how to use a tool effectively, that doesn't mean that the tool is inherently bad.
 
I wonder if when you guys cook pasta, if you cook a single piece at a time. Or when you go to wash your hair, if you turn on the water, shampoo a single hair follicle, turn off the water, dry off, then take another shower for every single strand of hair you have. Because this is essentially what RAII is doing under the hood, always, whether you want it to or not.

It's fucking mind blowing that we even have to have this discussion in 2026, but here we are. An entire fucking ecosystem of software being bogged down at every single step of execution just because some dickface refuses to close a file handle.
 
It's fucking mind blowing that we even have to have this discussion in 2026, but here we are. An entire fucking ecosystem of software being bogged down at every single step of execution just because some dickface refuses to close a file handle.
There is no discussing it with you because you are fundamentally misunderstanding what RAII is about.

I wonder if when you guys cook pasta, if you cook a single piece at a time. Or when you go to wash your hair, if you turn on the water, shampoo a single hair follicle, turn off the water, dry off, then take another shower for every single strand of hair you have. Because this is essentially what RAII is doing under the hood, always, whether you want it to or not.
What is bro yapping about.

RAII is memory management
That's simplifcation that's probably a reason why RAII have such a bad rep. RAII is not about memory, it's about resources which are much more abstract.
Containers still uses RAII to construct/destruct objects, but you don't have to allocate memory a lot of the times.
Moreover you can easily compose classes which should uphold their invariants thanks to ctors and release everything thanks to dtors after just object of top class is destroyed. All without having to manually keep track of what's need to be initialized and what's need to freed.
RAII is absolutely killer feature of C++, and reason why it keeps dominating in certain industries.
 
C++ is a low level programming language, please argue about Java, C# or, dare I say, Python if you want to discuss memory management's impact on performance. Thank you.

Jokes aside, I don't see why this is being argued, it's so goofy that I hope this is all banter going above my head. Use the language you like that is best suited, for you, to whatever it is you're working on. I like C++
 
With the degree to which he passionately argues about things he barely understands, I'm guessing our friend Intern here is a teenager. Very early 20s at best. I remember being that passionate about stupid inconsequential shit I barely understood at that age too (and that was a long time ago).

Still waiting to be educated on how I can connect to a BSD socket from browser JavaScript by the way. Or perhaps an admission you might not know more about a certain field than someone who's been working in it professionally since (most likely) before you were born?

If C works for you, that's great. Other people have different priorities, and for them there are different languages and ecosystems. Even though that means we have to put up with some real garbage tech (JS/Node/Electron) or garbage communities (Rust) at times, on the whole I think that's a good thing. In twenty or thirty years, or ten if you're lucky, you're going to realize how silly and pointless it was to call people slurs on the internet for preferring to get their work done in a different manner than you and feel embarrassed, mark my words.
 
Last edited:
Translation: I am the actual fucking retard that doesn't understand that resources don't need to be acquired and released 1,000 times every second, slowing down my entire fucking program by a factor of 10, just because I am too much of an ignorant faggot to learn how to manage memory in non-idiotic ways such as not releasing it every single fucking time scope changes
Translation: I am a nigger that can't hoist resources out of a hot loop.
 
Still plugging away at SICP, just at a slower pace than I'd like. I'm also using both Scheme and Racket for coding/logic puzzles and utility script type work. Might've said this before, but I am beginning to develop an appreciation for Lisp, even though I doubt it'll become my daily driver for stuff I don't need to share the source of with others.

It's easy to create a mental model of my program's structure, and understand how that maps to what actually gets computed, as I am writing it. Not what I want my code to do, but what it will compute. The framing they use of sort of creating a basic algebra for computational problem-solving is a brilliant pedagogical move too IMO.

Maybe this is controversial, but it's the best introduction to lambda calculus I've read. I'm not a math PhD or anything though.
 
With the degree to which he passionately argues about things he barely understands, I'm guessing our friend Intern here is a teenager. Very early 20s at best. I remember being that passionate about stupid inconsequential shit I barely understood at that age too (and that was a long time ago).
he was shitting up the karl jobst thread too
 
you're going to realize how silly and pointless it was to call people slurs on the internet
In 2026, it is always pointful to call niggers and faggots by their proper titles, if only for practice. Intern is clearly a newfag but the "C++ has RAII and C doesn't" horseshit is also bad. If fast/clear init is required, that can be a single function call in C, and it can make for clearer and more explicit program flow than RAII spaghetti like I've seen in some C++ codebases. Remember, every language feature can and will be abused to make jeet-tier code.
 
Isn't AWS completely overrun with jeetcode? I'm considering taking on work using my technical skill but really don't want to ruin a hobby I love dealing with some bloated crap written by morons.
It is an infrastructure-as-code platform. Pretty much everything is Dockerised microservice, and you have to learn to structure your data around DynamoDB and deal with the odd stuff around CloudFormation and CDK deployments. To get the best out of it, you need to basically do TDD and have a proper architect, sprints etc.

The place I work at doesn't do that, I work with retards who don't do the "yes I understand that" even though they don't (no they aren't Indian) and I hate it. I just get Claude and OpenCode to do all the coding for me now, while I watch YouTube videos as I've basically given up trying at this point.
 
RAII's greatest crime is convincing C++'s designers that they don't need a "finally" or "unwind-protect" equivalent. "Just create a new type that only has a destructor so you can create a lexical scope that contains a single instance of it, oh wait it needs access to the enclosing scope, I guess you also need to create a constructor for it that stores a bunch of pointers at runtime to everything it could possibly need to access. Zero-cost abstraction btw" - statements dreamed up by the utterly deranged.
 
RAII is memory management; C++ automatically calling certian functions for you is a convenience to make things less tedious, just as C handles function calls and the stack, or how malloc/free actually do the hard work for you. There is a great benefit to reducing the amount of noise that the programmer has to deal with. Just becuase some people don't know how to use a tool effectively, that doesn't mean that the tool is inherently bad.
I go a step further and argue that manual resource management as a regular practice often leads to shittier code.

Not always and everyone hacks things together sometimes because it is simpler. But most of the time, the risk of fucking it up isn't worth it. It's not just about writing it correct once. It's about a conversation you're having with anyone else who might contribute to the project, including your past self and your future self. And your future self who's tired at 2am and you're just trying to push out a fix and be done with it.

And little resource leaks can stick around as vulnerabilities for years.

Everyone makes mistakes. It's not a matter of being a super badass low level programmer. Everyone, everyone fucks up. And once a good semi-automated solution for a resource management problem is found, almost always those solutions are better, amortized over your time and effort, than regularly doing a more careful, more precise job by hand. Doing the job by hand isn't ever 100% perfect, and just a few fuckups wipe away any efficiency gains you get by doing it by hand.

I was load testing something for work the other day and I learned firsthand why db connection pools default to low numbers like 8 and 32. It's because apparently database connections for things like postgres or mysql can get pretty fucking big. Especially postgres.

Right now we often tune the sizes of these connection pools by hand. Automated approaches are slightly better and slightly more wasteful of the immediate resource you're talking about. But they save resources over time.

I've worked as a software dev for smaller companies where I had to write the software and deploy it, and managing resource settings is a huge, detailed job. It's way more expensive of my time to see someone (often me) tried to implement something more manually and realize that they fucked up and we all would've been better off using a dumber, less nuanced, automated approach to allocation and leave it tunable to whoever is deploying it.

Though nowadays I'm at a company with a dedicated infra guy and I don't think he knows how to program, so that kinda annoys the shit out of me. I'm doing his job a lot. When I was doing the infra stuff, I can look at the code to see what it's doing. I don't think he can.

Jeets though, what are you gonna do?
 
Still waiting to be educated on how I can connect to a BSD socket from browser JavaScript by the way. Or perhaps an admission you might not know more about a certain field than someone who's been working in it professionally since (most likely) before you were born?
I want to go even further and say that webdevs should never have access to system sockets, ever. It's bad enough with the odd, though mostly harmless 127.0.0.1 access attempts.

In twenty or thirty years, or ten if you're lucky, you're going to realize how silly and pointless it was to call people slurs on the internet for preferring to get their work done in a different manner than you and feel embarrassed, mark my words.
Surely there's a middle ground. For example, every time I update apps on my phone and see 300+ MB package sizes, shit being laggy or just another pretend app that's actually a browser wrapper, I start thinking of murder. Does that mean I shouldn't? Well, silly me, that developer just values his time and defecated some Javascript on my Android device to get Real Work done. Stiff upper lip and keep scrolling.
 
Surely there's a middle ground. For example, every time I update apps on my phone and see 300+ MB package sizes, shit being laggy or just another pretend app that's actually a browser wrapper, I start thinking of murder. Does that mean I shouldn't? Well, silly me, that developer just values his time and defecated some Javascript on my Android device to get Real Work done. Stiff upper lip and keep scrolling.
There is, but sperging about C++ vs C isn't it. Bemoaning the Netspace nigger that wrote Javascript's interpreter in a lisp filled 1 week haze is definitely a more productive, if futile, use of time.
 
The reality of the situation, no matter how hard the memfags refuse to take Stroustrup's dick out of their mouth, is that we have to wait 10 to 15 seconds for photoshop to load - a process that should be nearly instantaneous- and that's on a good day.

The proof is in the pudding, and your shit sucks. Period.

Clearly there is a steep cost associated with RAII and OOP and the entire retarded ecosystem of mainstream programming.

Conceptually, everyone here understands why it's a stupid idea to take an entire shower for every single strand of hair you have. And yet some have no idea how that applies to "resource acquisition" and memory management. Because you don't know what you don't know.

Intelligent memory management looks nearly identical to how the CPU manages the stack. Does it go through, row by row, and "release" every single "resource" used? NO. It resets a pointer back to the beginning of the stack. Boom, done.

The same is done with memory. Allocate a block of memory and store data in there that only needs to exist within the lifetime of that arena. When you're done, set a pointer offset back to zero. Boom. Done.

To the dickface crying that resources can be passed into functions, so this is dAnGeRoUs- guess what, dickface? You can also pass pointers to your memory allocation in a function.

For really transient work just use a disposable scratch arena for that scope. You don't even need to free or reset anything.

Your memory block has filled up? Extend it.

Terrified that you'll access a resource that no longer exists? Design your code so that even in failure, it will still carry on.

Computing really is this simple, and yet complete fucking retards have turned what was once a beautiful and elegant artform into bloated, over architected diaper-soiling prevention that still manages to make you soil your diapers anyway.
 
Back
Top Bottom