submitted by SithEmpire to C2 monthsApr 1, 2025 16:23:31 ago (+18/-0) (C)
In part to combat the wave of junk articles crapped out by generative AI with examples using the most faggy language (python) ever designed, I decided to start showcasing various aspects of C++, easily my preferred platform.
It has its oversights and shortcomings I'll also present, but generally C++ has a respectable, formal style which helps the compiler produce performant and efficient binaries while also exposing the abject peasantry of various other languages once you get to know it. Exactly as human language was more well-spoken decades ago, so too was computing language, to the extent that using other platforms seems like writing foul-mouthed vulgarity in comparison.
This is also sort of a test-post to see how well the site formatting system handles code (I tried it in a message to myself but the formatting doesn't work there).
` #include <iostream>
int main(int, char**) { std::cout << "The iostream syntax is weird, but allows for some compile-time checks and runtime safety.\n"; std::cout << "Terry Davis was right about it being niggery compared to printf though.\n"; return 0; } `
If the code delimiters don't work, it'll probably interpret the pointer asterisks as bold text, or perhaps the include directive as a HTML header level.
If the `code` doesn't work, it's because you have a messed-up C++ compiler resulting from another attempt at Embrace-Extend-Extinguish. For sake of argument I'm using GCC g++, but in general a compliant compiler ought not require preprocessor directives specific to itself.
I'm a fan of how C# provides a ref keyword, that memory management while passing stuff around is the fabric of good performance! The get/set syntax integration is an interesting feature, although LINQ seems like using it is a good way to become locked to the platform.
Inelegantly-written code is hard to read more so than C++ is hard to read; unfortunately a large body of the former has accrued.
C++ results in slower development and more bugs as it is harder to read.
With the aid of modern AI, this will never be an issue ever again.
These days, you can write in something super high level, pseudocode even, and get usable working low level code. And, unlike in high level languages, you can come in and optimize the critical bits o the output for execution speed. You don't have to choose between fast dev and fast execution when choosing a language anymore.
I might be out of the loop, but I thought C# was dead?
One thing I’ve always found dumb about C or C++ was function prototypes. Just write the stupid function, no need to define it one place and have code in another place. Just dumb.
[ - ] SithEmpire [op] 1 point 2 monthsApr 1, 2025 17:50:06 ago (+1/-0)
It's where the age of the language shows a bit, but there is a reason at least - if a header file declares the function and a separate source file implements the function, that source can be compiled once as a separate translation unit then used repeatedly by calling code, the latter only including the header then letting the linker sort it out.
With a separate unit, the former can keep any static variables/functions contained and hidden from the global scope of the main program, it's protected from conflicting includes from the main program, and changes made to the main program can be compiled more quickly when it isn't also recompiling the included function (and vice versa). Two functions A and B which call each other recursively also cannot be compiled at all without at least declaring B first, implementing A in terms of the prototype of B, then implementing B in terms of the now-present A.
Such reasons may not be very convincing given that some are products of the age of the platform, but reasons are at least present!
With a separate unit, the former can keep any static variables/functions contained and hidden from the global scope of the main program, it's protected from conflicting includes from the main program, and changes made to the main program can be compiled more quickly when it isn't also recompiling the included function (and vice versa). Two functions A and B which call each other recursively also cannot be compiled at all without at least declaring B first, implementing A in terms of the prototype of B, then implementing B in terms of the now-present A.
I used to know all this shit years ago before python irreversibly mutilated my mind.
The only thing I like about python in regards to C++ is button and ribbon creation. Other than that C++ is king. Python gets to be a headache at larger code bases, making sure everything is indented correctly.
I've been using AI a lot lately, not going to lie, you can put up to around 3000 lines of code into deepseek and tell it to format and indent it correctly for you. It also gives you ideas that are good most of the time. It's kind of wild.
I've ended up paying the $20 a month to get access to openai's much better AI's as well. Deepseek gets bogged down at times, and I've kind of started to use it as a crutch. Haha, it does so much instantly I cant not use it.
Sometimes it does get retarded and change function names or switch code format for one section of one function randomly, but 90% or more of the time it knocks it out of the park.
Lol, not programming-related but about AI: My dad was a book publisher and he would translate and edit books from and to various languages. He no longer has his publishing house, but still works freelance because he's kind of a big name in that field. He admitted to me recently that he pays for an AI program and all he does now is proofread and edit the little that needs attention. Easy money.
The paid openai subscription gives you access to o1. It's a little better than deepseek, and allows longer inputs. It's actually ridiculously smart at single task problems. I heard the $200 a month one is next level, and as soon as all the normies have access to that one things are going to get weird. It can make high level software from a prompt alone in whatever code you tell it to code in. There's some guys on reddit who are making high level software and have no idea how it works and getting paid for it. Throw a prompt into it, test the software a little bit, profit.
My understanding is that, with a few caveats, o1 is now bottom of its generation. Gemini exceeds it in research tasks, Claude exceeds it in programming, the 70b 4bit gwen reasoning distills of R1 beat o1-mini in all metrics, and the full deepseek R1 edges out O1 in just about everything, hence OpenAI shitting themselves.
I heard the $200 a month one is next level
As usual, they are behind the pack again. What you are referring to is the latest trend in AI, agents. Basically, a 'manager' ai manages a bunch of smaller specialized AIs which do smaller subtasks of the larger task you gave the 'manager'. Look at e.g. Manus for the version you will most likely end up using: https://www.youtube.com/watch?v=K27diMbCsuw&t=236s
Gemini has a paid tier where they are slowly rolling out an agentic AI as well.
[ - ] SithEmpire [op] 1 point 2 monthsApr 1, 2025 17:20:01 ago (+1/-0)
Definitely from that microprocessor perspective, straying beyond C can start to work against the embedded system interfaces! I'm okay with a class being in effect a slightly different version of a struct and some functions, as long as it compiles down to something the micro can run; conversely, growable C++ containers such as std::string or std::vector likely should be avoided.
C++ isnt even a proper pbject oriented language, neither is Java or C#. The fixed types make these languages a terrible idea for large projects, hence why aspect oriented programming was invented and then dropped. I think C++ is the most faggy language out there of any sizeas it is C with objects, possible outperformed by being faggy only by golang (with that gopher....).
Welp, looks like the site has no actual working monospace markup for code, at least none I can see. The link syntax also looks like it'll activate when it sees C++ lambda syntax, literally may need to make text images instead.
[ + ] Belfuro
[ - ] Belfuro 4 points 2 monthsApr 1, 2025 19:03:16 ago (+4/-0)
C++ however will never be replaced.
My favorite language is c# by far
[ + ] SithEmpire
[ - ] SithEmpire [op] 2 points 2 monthsApr 1, 2025 19:32:06 ago (+2/-0)
Inelegantly-written code is hard to read more so than C++ is hard to read; unfortunately a large body of the former has accrued.
[ + ] Belfuro
[ - ] Belfuro 1 point 2 monthsApr 1, 2025 20:00:38 ago (+1/-0)
Us devs have to have real world coding experience because properly written code in say solid principles are rare.
[ + ] aleleopathic
[ - ] aleleopathic 0 points 2 monthsApr 2, 2025 01:42:19 ago (+0/-0)*
With the aid of modern AI, this will never be an issue ever again.
These days, you can write in something super high level, pseudocode even, and get usable working low level code. And, unlike in high level languages, you can come in and optimize the critical bits o the output for execution speed. You don't have to choose between fast dev and fast execution when choosing a language anymore.
I might be out of the loop, but I thought C# was dead?
[ + ] AugustineOfHippo2
[ - ] AugustineOfHippo2 3 points 2 monthsApr 1, 2025 17:34:48 ago (+3/-0)
[ + ] SithEmpire
[ - ] SithEmpire [op] 1 point 2 monthsApr 1, 2025 17:50:06 ago (+1/-0)
With a separate unit, the former can keep any static variables/functions contained and hidden from the global scope of the main program, it's protected from conflicting includes from the main program, and changes made to the main program can be compiled more quickly when it isn't also recompiling the included function (and vice versa). Two functions A and B which call each other recursively also cannot be compiled at all without at least declaring B first, implementing A in terms of the prototype of B, then implementing B in terms of the now-present A.
Such reasons may not be very convincing given that some are products of the age of the platform, but reasons are at least present!
[ + ] prototype
[ - ] prototype 3 points 2 monthsApr 1, 2025 17:57:23 ago (+3/-0)
I used to know all this shit years ago before python irreversibly mutilated my mind.
[ + ] aleleopathic
[ - ] aleleopathic 1 point 2 monthsApr 2, 2025 01:44:42 ago (+1/-0)
[ + ] shitface9000
[ - ] shitface9000 1 point 2 monthsApr 1, 2025 19:28:35 ago (+1/-0)
[ + ] NoRefunds
[ - ] NoRefunds 0 points 2 monthsApr 1, 2025 21:50:21 ago (+0/-0)
If you want something done by next week from scratch, use python.
[ + ] registered_bot
[ - ] registered_bot 1 point 2 monthsApr 1, 2025 19:01:53 ago (+1/-0)
[ + ] SithEmpire
[ - ] SithEmpire [op] 0 points 2 monthsApr 1, 2025 19:37:26 ago (+0/-0)
[ + ] registered_bot
[ - ] registered_bot 2 points 2 monthsApr 1, 2025 19:54:32 ago (+2/-0)
I've ended up paying the $20 a month to get access to openai's much better AI's as well. Deepseek gets bogged down at times, and I've kind of started to use it as a crutch. Haha, it does so much instantly I cant not use it.
Sometimes it does get retarded and change function names or switch code format for one section of one function randomly, but 90% or more of the time it knocks it out of the park.
[ + ] MuricaPersonified
[ - ] MuricaPersonified 1 point 2 monthsApr 1, 2025 23:18:42 ago (+1/-0)
[ + ] registered_bot
[ - ] registered_bot 1 point 2 monthsApr 2, 2025 00:39:24 ago (+1/-0)
[ + ] aleleopathic
[ - ] aleleopathic 0 points 2 monthsApr 2, 2025 01:55:15 ago (+0/-0)
My understanding is that, with a few caveats, o1 is now bottom of its generation. Gemini exceeds it in research tasks, Claude exceeds it in programming, the 70b 4bit gwen reasoning distills of R1 beat o1-mini in all metrics, and the full deepseek R1 edges out O1 in just about everything, hence OpenAI shitting themselves.
As usual, they are behind the pack again. What you are referring to is the latest trend in AI, agents. Basically, a 'manager' ai manages a bunch of smaller specialized AIs which do smaller subtasks of the larger task you gave the 'manager'. Look at e.g. Manus for the version you will most likely end up using: https://www.youtube.com/watch?v=K27diMbCsuw&t=236s
Gemini has a paid tier where they are slowly rolling out an agentic AI as well.
[ + ] Deleted
[ - ] deleted 0 points 2 monthsApr 2, 2025 03:26:23 ago (+0/-0)
[ + ] watts2db
[ - ] watts2db 1 point 2 monthsApr 1, 2025 18:34:33 ago (+1/-0)
[ + ] SithEmpire
[ - ] SithEmpire [op] 1 point 2 monthsApr 1, 2025 19:35:02 ago (+1/-0)
[ + ] CoronaHoax
[ - ] CoronaHoax 1 point 2 monthsApr 1, 2025 18:09:17 ago (+1/-0)
[ + ] WyattDonnelly
[ - ] WyattDonnelly 1 point 2 monthsApr 1, 2025 17:00:41 ago (+1/-0)
C is the only worthwhile language. (And, yes, fuck Python.)
[ + ] SithEmpire
[ - ] SithEmpire [op] 1 point 2 monthsApr 1, 2025 17:20:01 ago (+1/-0)
[ + ] RevengeOfNeri
[ - ] RevengeOfNeri 0 points 2 monthsApr 1, 2025 18:44:59 ago (+0/-0)
[ + ] BrokenVoat
[ - ] BrokenVoat 0 points 2 monthsApr 2, 2025 09:17:28 ago (+0/-0)
[ + ] SithEmpire
[ - ] SithEmpire [op] 0 points 2 monthsApr 1, 2025 17:36:22 ago (+0/-0)
[ + ] NoRefunds
[ - ] NoRefunds -1 points 2 monthsApr 1, 2025 21:49:00 ago (+0/-1)