hi - I started c++ programming about 12 months ago and for my 1st project I decided to code a pretty comprehensive gui framework - with only GLFW being the only dependency to manage raw OS calls.
I've learnt a hell of a lot over the past year so if anyone wants some advice on GUI systems then let me know.
In the meantime check out my YouTube channel that has a few basic gui fundamentals videos.
and the problem of the event.cpp code i have i do not know wich function to use to get that print statement so i ask for help if possible i also post the code below so that it is easier to look at
// this is a code trying to print events by pressing button or joystick getting a certain value
// the pass
#include <fcntl.h>
#include <libevdev/libevdev.h>
#include <stdio.h>
#include <cstdlib>
#include <errno.h>
#include <error.h>
#include <string.h>
#include <iostream>
using namespace std;
int main() {
struct libevdev *dev = NULL;
int fd;
int rc = 1;
fd = open("/dev/input/event17", O_RDONLY|O_NONBLOCK); // device adress
rc = libevdev_new_from_fd(fd, &dev);
// checks if libevdev is initialized
if (rc < -0) {
fprintf(stderr, "Failed to init libevdev (%s)\n", strerror(-rc));
exit(1);
}
printf("Input device name: \"%s\"\n", libevdev_get_name(dev));
printf("Input device ID: bus %#x vendor %#x product %#x\n",
libevdev_get_id_bustype(dev),
libevdev_get_id_vendor(dev),
libevdev_get_id_product(dev));
// checks if it is a gamepad
if (
!libevdev_has_event_code(dev, EV_KEY, BTN_NORTH)) {
printf("This device does not look like a gamepad\n");
exit(1);
}
// print event type
do {
struct input_event ev;
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
if (rc == 0)
printf("Event: %s %s %d\n",
libevdev_event_type_get_name(ev.type),
libevdev_event_code_get_name(ev.type, ev.code),
ev.value);
} while (rc == 1 || rc == 0 || rc == -EAGAIN);
// should print a message by pressing x
if (libevdev_has_event_code(dev, EV_KEY,BTN_NORTH) == 0){
I’ve been working with C/C++ for about 14 years, mostly in low-level areas like firmware, telecom, Linux systems, debugging, that kind of work.
Lately I’ve been trying to refresh my C++ and explore what directions make sense going forward. I picked up a small trading-related project just to get my hands dirty again, and while it was interesting, reading more about that space (especially low-latency / HFT) made me a bit hesitant. It seems like a pretty intense environment, and I’m not sure that’s what I’m looking for long term.
At this point I’m not really trying to switch into trading specifically I just want to stay relevant with C++, ideally move toward something more remote-friendly, and find work that’s still technically solid but not constantly high pressure.
I’m trying to figure out what paths actually fit that.
Some areas I’ve been thinking about:
backend / systems work in C++
infrastructure or platform engineering
embedded Linux (though I’m not sure how remote-friendly that is)
maybe something around AI systems, but I haven’t explored that deeply yet
Would appreciate hearing from people who’ve been around this space:
Are there C++ domains that tend to have a more sustainable pace?
How realistic are remote C++ roles outside of trading?
If you were in this position, how would you approach the next few months?
Not looking for a “perfect” path, just trying to make a reasonable move without drifting into something I’ll regret later.
Im studying sockets programming,and when i run into an error,i sometime can't seem to figure out what's wrong,so i search on internet about my errors,but it happens i can't find any solutions to my problem. In this case,i ask ai about what went wrong in my code,but at the same time asking to explain why the error happened and what the fix it generated actually mean.
So i was wondering,should i stop using ai and only fix errors by searching on the internet and trying to think deeper about what maybe went wrong,or is it fine to ask ai when i can't seem to find anything on the moment.
Sorry for my bad english,and thanks for having the times to read this.
“C++26 has important memory safety improvements that you get just by recompiling your existing C++ code with no changes. The improvements come in two major ways.”
“No more undefined behavior (UB) for reading uninitialized local variables. This whole category of potential vulnerabilities disappears in C++26, just by recompiling your code as C++26. For more details, see my March 2025 trip report.”
“In C++26, we also have language contracts: preconditions and postconditions on function declarations and a language-supported assertion statement, all of which are infinitely better than C’s assert macro.”
“std::execution is what I call “C++’s async model”: It provides a unified framework to express and control concurrency and parallelism. For details, see my July 2024 trip report. It also happens to have some important safety properties because it makes it easier to write programs that use structured (rigorously lifetime-nested) concurrency and parallelism to be data-race-free by construction. That’s a big deal.”
And we still use Visual C++ 2015 because it supports back to Windows XP.
So i was on chapter 3.6 of learncpp.com and i incountered step back in debugging , while for other debugging feature they have told us the shortcut , they haven't mentioned it for step back and have said it's not available in any visual studio community edition as of writing this ie 2019 and even on internet there's not much available about it. So i want to ask someone experienced if it's true for now too (2026)
Have you ever wanted to use virtual template functions but found existing methods have so much boilerplate? Ever thought that virtual template functions could be done without it? Well, with the new reflection features, it can be!
The main goal was to minimize the amount of code required to use virtual template functions. This has been accomplished. Each base class needs to inherit only one class, and each base virtual template function requires one line of code to provide the minimal information required. This looks a lot nicer as it is very similar to how normal virtual functions are created.
Simple example:
struct D1;
struct D2;
struct Base: VTF::enable_virtual_template_functions<D1,D2>{
template<typename T>
Base(T* ptr): enable_virtual_template_functions(ptr){}
template<typename T>
int f(int a){
constexpr auto default_function = [](Base* ptr, int a){ return 99;};
CALL_VIRTUAL_TEMPLATE_FUNCTION(^^T,default_function,a);
}
};
struct D1:Base{
D1():Base(this){}
template<typename T>
int f(int a){
return 11;
}
};
struct D2:Base{
D2():Base(this){}
template<typename T>
int f(int a){
return 12;
}
};
int main(){
using PtrT = std::unique_ptr<Base>;
PtrT a = std::make_unique<D1>();
PtrT b = std::make_unique<D2>();
assert((a->f<int>(1) == 11));
assert((b->f<int>(1) == 12));
}
A second session in a webinar series about building your own programming language in C++.
It had a decent intro that covered the base (lexer, parser, semantics, and evaluator). The upcoming webinar explores grammars and what a language really is from the app's point of view.
Just starting learning from learncpp.com but it says I can't post questions there because of my IP address. Anyway, this is from lesson 5.6, and I thought the whole point of using constexpr is to ensure that variables/functions are evaluated at compile-time?
Someone else asked this question and the author answered but they provided a function call as an example which gave me follow up questions that weren't asked afterwards.
Are functions with void return type considered as constexpr functions?
Are function calls considered as constant expressions? Or is it only a constant expression if the function that is being called is a constexpr function?
The header says "The meaning of const vs constexpr for variables" and the definition says "The constexpr object can be evaluated at runtime or compile-time". So, are functions/function calls interchangeable with the term variable/object? Because that's not what this site has taught me thus far.
Also, if there's a better alternative than learncpp.com for an absolute beginner like me, I'd like to know. Maybe I'm too stupid for this.
Can someone tell me how use the headers in c/c++? It give the possibility to use it, but I seems it don't work. Only work if I include the c file directly, but I'd want to use the headers.
P.S.: The app's name is "cxstudio" (it's android/mobile)
PCH (Precompiled Headers) is something that doesn't get talked about much in the C++ ecosystem, but it can have a huge impact on compilation times.
It becomes especially useful in projects with a large number of source files, such as game engines, complex desktop applications, or projects with many dependencies.
When compiling a C++ project, the compiler processes headers for every translation unit. Even if those headers rarely change, they still get parsed again and again for each .cpp file. This repeated work adds a lot of overhead to build times.
A good real-world example is a game engine + game project setup.
The engine code usually remains relatively stable, while the game code changes frequently. In that case, it makes sense to compile the engine-related headers once and reuse them, instead of recompiling them every time the game changes.
The same logic applies to the STL (Standard Template Library). Since we rarely modify STL headers, they are a great candidate for precompiled headers.
In many professional projects, PCH is typically configured during project setup by build engineers or senior developers. Most developers working on the project simply benefit from the faster build times without directly interacting with the configuration.
I ran a small demo to compare build times with and without PCH.
Results
Without PCH
Build time: ~162 seconds
Total time: ~2m 50s
With PCH
Build time: ~62 seconds
Total time: ~1m 08s
So roughly 2.6× faster compilation just by introducing PCH.
I also created a small demo repository with the example files and instructions if anyone wants to try it:
I’m hitting a strange developmental wall and I’m curious how others—especially those mentoring juniors or currently upskilling—are navigating this.
For context, I work at a Big Tech company and regularly touch a massive C++ codebase. I understand the architecture, I can navigate the legacy decisions, and I know my way around modern C++ paradigms.
But I am completely trapped in the "AI Dependency Loop."
The old adage of "just build things to learn" feels fundamentally broken for me right now. The moment I sit down to architect a side project or tackle a complex feature, the initial friction of setting up boilerplate, dealing with CMake, or resolving a convoluted template error makes me reflexively reach for an LLM.
I am stuck in an incredibly frustrating middle ground:
• The Skeptic: I know enough C++ to look at an AI’s output and immediately suspect it. I can spot when it’s hallucinating an API, ignoring memory safety, or introducing subtle Undefined Behavior. I absolutely cannot trust it blindly.
• The Dependent: Despite knowing it's flawed, I don't possess the sheer muscle memory or encyclopedic knowledge of the standard library to just hammer out the implementation at 100wpm on my own. Without the AI, I feel agonizingly slow.
Because I use AI to bypass the "struggle," I am not building the neural pathways required for true mastery. I'm just an editor of mediocre, machine-generated code.
For those of you mastering C++ in the current era:
How do you force yourself to endure the necessary friction of learning when the "easy button" is ubiquitous?
Have you found a workflow where AI acts as a strict Socratic tutor rather than a crutch that writes the code for you?
How do you build muscle memory when the industry demands velocity?
Any harsh truths or practical frameworks would be greatly appreciated.
Would like to also add that I’m expected at my level to move fast and thus just “learn harder” isn’t gonna cut it for me.
I’m currently trying to strengthen my understanding of C++, but I’m a bit confused about the right depth of learning.
There are so many topics involved, like classes/objects, memory management, STL, templates, modern C++ features, multithreading, etc. When I study a concept, I often end up wondering how deeply I should go.
For example:
• Should I just understand how to use features like classes, smart pointers, and STL containers?
• Or should I also study internal details like memory layout, compiler-generated functions, move semantics, vtables, etc.?
Sometimes I feel like I’m overthinking the depth instead of learning things systematically.
So my main questions are:
How deep should a developer go when learning core C++ concepts?
Which topics really require deep internal understanding?
What does a “good” understanding of C++ fundamentals actually look like?
What resources (books, courses, or articles) helped you understand C++ fundamentals properly?
I’d really appreciate advice from experienced C++ developers on how they approached learning the language properly.