Overload Journal 181 - June 2024
https://accu.org/journals/overload/overload181
https://redd.it/1df2cu3
@r_cpp
How To Convert Char Array String To Unicode String Correctly In C++?
https://learncplusplus.org/how-to-convert-char-array-string-to-unicode-string-correctly-in-c/
https://redd.it/1dex5a8
@r_cpp
Why is C, and C++ so hard to work with when it comes to dependencies, and header files in Linux
Hi there!
I was learning on how to make a ray tracer by The Cherno. I have intermediate programming skills, and I thought I could handle it. But immediately I hit my first roadblock with C++. I don't know how to even run the project in the first place(apart from a single file Hello World with a header.h). What makes it even more complicated, he is using a solution file with Visual Studio to compile all of this stuff. But I'm on Linux, and use VSCode. So that was a bust. I tried to run it normally by running gcc to the WalnutApp.cpp but that is giving me include header directory errors(not found). So it's very disheartening for me, that for C++ to work, I have to learn CMake. Which is way too complicated for me to even begin to understand. What do I do? Where do I even begin?
Here is the template I use for the project incase you wanted to know: https://github.com/StudioCherno/WalnutAppTemplate
https://redd.it/1devq8q
@r_cpp
Need Advice: Should I Continue Learning JavaScript or Switch to C++ and AI?
Hey everyone,
I'm a 16-year-old 10th grader currently diving into the world of web development. I've been learning JavaScript for a while now, and I'm about 30% through the "Definitive JavaScript" book and also following an online course.
I recently reached out to my cousin, who has been a web developer for about 4 years, to get some tips on JavaScript. However, he advised me to stop learning JavaScript, saying the web development market is saturated. Instead, he recommended I focus on AI, learn C++, and dive into data structures and algorithms (DSA).
Now I'm a bit confused about what to do next. Should I:
1. Leave JavaScript and start learning C++ and AI immediately?
2. Complete my current JavaScript learning path before moving on to C++ and AI?
Would love to hear your thoughts and advice on this. Thanks!
https://redd.it/1deq4g5
@r_cpp
Recommendations for memory pools that work with virtual base classes (tree use case)
Hi all.
I am implementing a tree like data structure with a node base class and multiple derived classes. I am looking for a memory pool to allocate the various derived nodes with, but also properly destructs all the allocated nodes (as in via their destructors). For context, at some point in the program I want to destroy all the trees I have created hence why I think a memory pool would be a good way to deallocate all memory at once.
Previously I naively used boost::pool<> and allocated the derived classes with it via new (pool.malloc()) ChildNode1
before realising the pool had no concept of the data it was storing so naturally their destructors were not called and data with additional allocations like vectors/strings were not being cleaned up.
Next I looked at using boost::object_pool<Base>
however that does not compile as the Base class is virtual.
Looking for suggestions on how this might be achieved (with or without libraries). I'm aware that I could use a std::map<std::unique_ptr<Base>> and just grab the raw point to the node, but I would like the nodes to be allocated within blocks.
Thanks.
https://redd.it/1def4r4
@r_cpp
Audio Library suggestion for multitrack playback
I'm working on C++14 with D3D9 and Win32 / x86 (yep, ancient) game.
I need to implement a feature where the music instruments will fade out / in based on the player current performance. Lets say, if player is with a bad rank through the dungeon, only percussion will be played.
Whenever he/she keeps combos without being hit, the ranking would be progressively incraese up to a maximum, where all instruments would be playing.
So, i'm already stripping instruments from current musics into individual sound files with an AI app named Moises - it's extremely cheap.
Now I need a way to implement the playback of all these individual instruments at perfect timming, and having control of their volume, panning and changing music on the fly.
The game uses Direct Sound to play music, but I can't deal with Microsoft Win32 nor DSound code. I need suggestions for audio libraries. The easiest / simpler, the best.
https://redd.it/1defi80
@r_cpp
Making an app with a drawing canvas. Recommended libraries?
I'm looking to build a music engraving software where users can write in music and have it converted in real-time to musicXML format for playback. I know Qt is common for GUI's but I wonder if my specific needs are covered in that framework.
Does anyone have suggestions on libraries/tools to make this any easier?
https://redd.it/1de9zlu
@r_cpp
New C++ features in Xcode 16
https://developer.apple.com/xcode/cpp
https://redd.it/1de1jcb
@r_cpp
Is it possible to put ico overlay at lower-right instead of lower-left (windows ico overlay)?
I use IShellIconOverlayIdentifier to modify ico style of some files, and it works well, but the overlay ico is at lower-left, Is it possible to put ico overlay at lower-right instead of lower-left ?
https://redd.it/1ddzs4s
@r_cpp
is there a wiki for c++ ?
hey guys so i recently decided that i just wanted to learn c++ and i really like the layout of the arch linux wiki, is there a good wiki thats like the arch wiki so i can learn ?
i really dont want to watch stupid videos and would much prefer to read a wiki and i was able to learn linux super fast this way and its very straight to the point.
i hope this isnt a stupid question ty guys :)
update: i found this https://cplusplus.com/doc/tutorial/introduction/ but please sent more !!!!
https://redd.it/1ddx3fn
@r_cpp
C++ has 11.6 million users according to SlashData, a developer research company
https://www.slashdata.co/post/59-of-developers-use-ai-tools-25-2m-javascript-users
https://redd.it/1dds9yd
@r_cpp
Thinking About A Website Where Donations Get Refunded If You Don't Reach Your Goal
Let's say your goal is $10,000 and the deadline is in 1 year.
After the year is up, if you don't reach your goal, everyone who donated would get a full refund.
I think this would encourage people to donate a lot more with confidence that their money isn't being wasted.
https://redd.it/1ddp72a
@r_cpp
Is it even possible?
Hello everybody, I recently got contacted by think cell, a German C++ company with a reputation for providing a 9 hour recruitment test simply to exploit the application for free work. I have read reviews about this company online, including German forums. I have gotten the impression that it is not possible to actually get hired by think cell, and they will find the smallest mistake in the 9 hour test to fail you. Everybody said they couldn’t get hired either way, not a single positive comment. So I ask you whether you have or know anyone who managed to get hired by think cell from this recruitment test. I want to know whether it is worth my time to work for such a company, and whether I should take this test.
https://redd.it/1ddg6j0
@r_cpp
Life Saving advice for CS Undergrad
So I'm joing Asansol engineering college (cse), tier 3 college, it is 20 min away from my home so I'll be day scholar, I still have 2-3 months before college starts, I have seen the syllabus which is MAKAUT affiliated and completed C programming and started C++ and Will soon start DSA before joining college, I have made my mind to take off campus placement and may be go to Qatar or Dubai, Europe (I have connections) for placement after my graduation, So what will be advice for me and Do's and Don't's! By the way i have many paid resources for free, so restrictions on that!
https://redd.it/1dd7yyu
@r_cpp
What is your experience with error propagation libraries?
Right now it seems there are quite a few nice looking error propagation libraries out there. Generally speaking such systems are pretty infectious within a codebase so choosing wisely is quite valuable. Reading the docs is useful, but in my opinion not much compares to actually having to live with and work with facilities. In that vein I was hoping to get some insight from people who have used the following libraries as to how they are once deployed; are there unexpected issues or benefits, any regrets; maybe it is rock-solid and doesn't get a second thought?
* [Abseil Status](https://abseil.io/docs/cpp/guides/status)
* [Boost LEAF](https://boostorg.github.io/leaf/#rationale)
* [{Boost,} Outcome](https://ned14.github.io/outcome/alternatives/)
* [`tl::expected`](https://github.com/TartanLlama/expected)
* [`std::expected`](https://en.cppreference.com/w/cpp/utility/expected)
While there are many differences between the above libraries it seems that perhaps the biggest, in API terms, is whether or not the error type is universal or not. `absl::Status` has a single error type for all possible errors, whereas the other libraries seem to take a bring-your-own approach. I'm more used to Abseil's approach and was curious about people's experience with writing their own. Do you write many error types and have to convert (perhaps noisily?) between them, do you end up with one big error type that you use most places, etc? Are there any missing from the above list that I should look at?
https://redd.it/1dbxpub
@r_cpp
Lock-free reference-counting a TLS slot using atomics, part 1 - The Old New Thing
https://devblogs.microsoft.com/oldnewthing/20240612-00/?p=109887
https://redd.it/1df2fml
@r_cpp
Limit the number of library dependencies
https://www.sandordargo.com/blog/2024/06/12/builds-and-dependencies
https://redd.it/1dewq6b
@r_cpp
An Idea for Full Thread Support for ISO C++
I'm proposing an enhancement to ISO C++'s threading capabilities, envisioning a more comprehensive module (std::multi_thread
as a concept) that encapsulates advanced features such as asynchronous processing, thread pooling, and refined multithreading controls, inspired by the elegance of JavaScript's async patterns. My motivation stems from the current limitations of std::thread
in terms of customization and the complexities encountered when applying std::async
and std::future
to classes and containers.
I aim to streamline concurrent programming by introducing more intuitive and flexible APIs, reducing boilerplate code, and enhancing performance through intelligent resource management akin to thread pools. This new module would not replace but complement existing standards, offering developers a more powerful toolset for managing concurrency in modern, complex applications.
I'm eager to gauge the C++ community's thoughts on this proposal. Have you encountered similar challenges with the current threading model? Do you envision benefits in having a more integrated, high-level threading solution within the language standard? If this idea sparks your interest or you have suggestions to refine it, please share your thoughts in the comments! Thanks!
https://redd.it/1detcgq
@r_cpp
GPU Parallelization for Non-Deterministic Model
Hi, I'm looking forward to implement a membrane computing model which is a non-deterministic model supporting maximal parallelism (in a sense that every possible 'rule' which can be applied, will be applied). I am new to GPU parallelization which is what I have in mind (also overall new to C++ parallelization techniques/libraries) and would like to hear some opinions on what options I am given to accomplish this task in C++.
Thanks
https://redd.it/1dejul0
@r_cpp
Several instructions inside for-loop initialization section
I've always wondered is there any possibility to use several instructions inside for-loop initialization section? It's would useful in cases when needed to initialize several variables of different types like this: for (int c = 0, float a = 0.1; ...; ...)
I found one example how it could be bypassed: struct { int a=0; char b='a'; } s;
, but is there any overhead?
https://redd.it/1dehhhs
@r_cpp
what are the things i have to look to write a secure code? also please rate my road map i have in mind :)
so, im programming for around 3 4 years now, tried couple things, messed with arduinos, python, a little bit js and stuff, the thing is im still in high school and not even going to university yet, and since im a self teaching teenager, u can guess that i never did anything that serious, how ever previous summer i got determined that im going to build my career on c++ rather than python, first choice cyber security, second choice software development, and third choice hardware programming, now im thinking i can go for all of them hopefully if i use my time correctly, so im writing a simple chat app in c++, cli based, how ever i want to write a secure code as much as i can so hopefully i also learn more about cyber security before going to university and also writing a program that actually is good, please share your exp with this young student :)
https://redd.it/1dec2gh
@r_cpp
Need feedback from experienced C++ developers
Hello.
Currently im during a process of developing an packer/protector for binary executables. Mainly for my self at the moment, but Im considering if there would be market for the solution. My solution would be an desktop GUI app, as well as shipped with CLI available binary (for servers aka CI/CD).
**The protector would work as follows:**
1. Load your binary into the protector.
2. Select the protection mechanisms out of available in the protector GUI.
3. Optionally save protection presets for future use, or for CLI use as well.
4. Export protected binary
**The protection features would be:**
* Anti-debuggers protection
* Strings obfuscations
* Import obfuscations
* Code flow / disassembly obfuscations
* Anti-VM protection
* On the fly License Manager (create/modify a user licensed by EMAIL + KEY or HWID)
* Binary size compression
The protector itself would be fully cross-platform solution. Meaning that the GUI and CLI tool could run the same way on Windows, Linux and MacOS machines. So the Linux host can manage Windows, MacOS and Linux binaries and vice-versa.
At the beginning I would support only Windows binary protection, meaning that the protection of Windows EXE and DLL only would be available at the beggining. No Linux ELF executables, and no MacOS Mach-Os - those would be added in the future.
The protector will make your binary nearly impossible to crack or even nearly impossible to investigate whats inside (lets assume that you don't want anyone to see how the communication with your remote backend server is done on the client side, as an example).
Does anyone would be interested of using such soft? If no please tell why. Are you using any solution that is currently available on the market? If yes, please tell me what can be done better.
Thanks
https://redd.it/1ddzhav
@r_cpp
libriscv: RISC-V Binary Translation, part 2
https://fwsgonzo.medium.com/libriscv-risc-v-binary-translation-part-2-deb3589375ad
https://redd.it/1ddzntd
@r_cpp
Am I the only one with this felling
Hello everyone, I always have the feeling that I am not capable of connecting in this field. By the way, I am a second-year IT student. I learned C and C++, and I built many projects using them. Also, I work with Express.js, React, and Docker. Currently, I am learning Java. But I do have the feeling that I am so bad, like I do not know anything, and I feel that I am not able to find a job in the IT field. Also, I feel that I need to know more because I do not know anything. And also, during these two years, I was not able to learn CSS. I do not know why, but I found it hard to learn. I build projects in front end, but when I use CSS or Tailwind, I waste time just centering a div or making the page responsive. Am I the only one who has this feeling, or am I the only crazy one here? Thank you.
https://redd.it/1ddxwr3
@r_cpp
Language features
So recently I started doing some katas in CodeWars - just a couple a day, nothing fancy, to keep the algorithmic problem solving brain oiled.
I'm not having much trouble arriving at solutions - oftentimes it's pretty clear, plus I'm just starting out. Still, I always get baffled when I see other people's solutions after delivering. They always yank out some weird cpp features that hack up the whole thing in under 10 lines
I'm curious about how one can go about to learn these features
https://redd.it/1ddppk4
@r_cpp
C++ based web server libraries that support hot reloading of TLS certificates
I've been using libmicrohttpd for creating webserver running HTTPS. I can't seem to figure out the dynamic reloading of certificates on expiration. The way i'm doing it now is by stopping and restarting the server with new certificate so there's some downtime. Are there any libraries out there which can reload certificates without downtime?
https://redd.it/1ddivhg
@r_cpp
Is learning C++ really meant to be this difficult?
Hey, so ive been learning c++ for the past 3-4 months. And ive learn about the basics like integers, float points, variables, vectors (sorta), if statement. And its soooo tiring, when im coding and im done I feel dead inside. And this is literally just the beginning of this. I don't know if I need a tutor or maybe a friend that does this. Because ive spent HOURS trying to do this and everytime I get lost and just feel whats the point. And im not even doing this for a job or anything because if I need to do this as a job I would literally die before doing this. But I want to do game developement and Im learning this for that, and thinking this is so complicated will it be so hard when im a game dev too? And I like making games (I havent made any) but I use blender made some little projects. I make music and produce probably my favorite thing to do. And I always wanted to learn C++ but now that im learning it im just soo lost. There's a lot of math problems which I SUCK at and its even just basics not like 250 lines of code its like 50 lines lol. And I don't even like math to begin with why does this have so much math in it?? Iiterally spent 4-5 hours on a program that shows prompts and it must store numbers for me, And I have needed to ask AI like 20+ questions about it. I have a notebook and im writing things down. I have a google doc with 60+ pages of things I write down and yet still it's so hard to do. And I know this isnt a easy language but still, I rarely get any joy from it and when I do its for like 5 seconds and then I realise there's another error somewhere. Like how is this fun to learn??? I just dont understand. Maybe if I had the right person with me or something Im not sure because I want to learn it so badly but its just such a pain with almost no reward you get at the end, Because I almost always fail and just need to ask AI the questions. After struggling for 3+ hours on the problem. So please anyone that knows c++ tell me how did you learn and was it even enjoyable because Im not even doing this for a paycheck at the end of the day. (sorry for the rant just needed to express this)
https://redd.it/1ddczw5
@r_cpp
Boost Your Debugging with Google Sanitizers!
Hey Community!
If you do competitive programming with C++ or use C++ in other areas, you should definitely check out my latest YouTube video on Google Sanitizers. These tools will help you catch bugs and improve your code quality!
Watch now
Happy coding!
https://redd.it/1dd725k
@r_cpp
Experience with concept compilation
In my personal hobby project, which is of a medium-largish size for a single developer, I use copious amounts of templates. I don't use a large amount of concepts, but there are a few places where I have needed their functionality. A good example is CRTP base class calling a derrived class' method non-virtually, and only if that method exists -- in essence, implementing Golang's implicit interfaces, non-virtually.
Since the beginning, I thought that concepts would increase compile-times, since template-related stuff generally does. However, I recently added a decent amount of concepts to an internal graph library. I have not noticed any type of compilation slowdown at all. Again, I don't have a ton of concept usage, but there is a non-trivial amount. I am pleasantly surprised.
I'm using the latest MSVC 2022
How are other people's experience with compilation speed when using concepts?
https://redd.it/1dd298w
@r_cpp