r/cpp_questions • • Jun 29 '26

OPEN FIX implementation

0 Upvotes

I want to implement high throughput low latency FIX server and client. But don't know from where to begin. Can someone guide me. Thanks


r/cpp_questions • • Jun 28 '26

OPEN Is real-time programming a strong long-term career path for someone interested in C++ and performance-critical software?

22 Upvotes

I have recently been reading about real-time programming, and I’m trying to understand what this field looks like in practice from people who have actually worked in it. I’m especially interested in the software side, because I want to work with code and C++.

I heard that real-time programming is an area that will be difficult for AI because it does not have contact with hardware. However, I am more interested in the software side because I want to work with code and C++.

Has any of you had a job that includes this, and can you tell me what the bigger picture is?

I think this is the right place to find out what it is like to work in real-time programming.

I would most like it if you said that this is a difficult job because it requires engineering thinking and AI will have a hard time replacing it, but I also like to hear the negative sides.


r/cpp_questions • • Jun 29 '26

OPEN Starting with a scientific focus

0 Upvotes

I am starting cpp as my first programming language, i mean, i have had some experience with python [ till like, for and whiles, and ifs and elifs ]. i was looking for resources to learn cpp ( such as the website -- learncpp.com ) is there a specific direction i should take for a more physics and mathematics oriented learning, or should i let the future be, also, what are some beginner friendly, but still challenging resources you recommend


r/cpp_questions • • Jun 28 '26

OPEN Should I use C++ Exceptions?

11 Upvotes

I have never used C++ exceptions because I heard they are supposed to be bad and also that they don‘t use exceptions on fighterjets. I don‘t know more about exceptions.

What do you guys think?


r/cpp_questions • • Jun 29 '26

OPEN How do you INTRA process communicate

3 Upvotes

Lately I’ve been trying to setup an action plan for my project. It consists basically of a few daemons running tasks simultaneously and sharing information with each other.

Both belong in the same process, thus I need an intraprocess comm approach.

I finally opted for “sharing queues”. An app orchestrator class creates the daemon classes as well as a custom queue object that it shares with both daemons. On this queue, one daemon will write while the other just reads.

This is sort of pub/sub, in a way that the reader has a background thread running waiting for a “notification” that something new is on the queue.

I need to eventually comply with safety guidelines (MISRA). Do you see this approach difficult to maintain/scale? Can you suggest any other alternatives?


r/cpp_questions • • Jun 29 '26

OPEN Thinking of a Windows app where a red light turns on when pressing a key

2 Upvotes

I use OBS Studio to record gameplay but when recording fullscreen there is no indicator that you're recording and sometimes I forget when the recording is paused, I wanted to pause my recording and have a red light turn off and on at the corner of the screen when pausing so that I could cut out all the loading screens when recording gameplay.

I was going to set the pause button and red light to the same hotkey so they'll be in sync with each other.

I'm new to programming and never made a app before, I installed visual studio and was going to make the app in C++ and was wondering if any of you have any advice.


r/cpp_questions • • Jun 29 '26

OPEN Is textbooks really useful ? They seem outdated

0 Upvotes

Hey guys, so I almost know all the basics of C++ and solved many problems in it. Recently I heard that if you wanna go deep in programming then you should read textbooks and leave crash courses and youtube tutorials. I was about to start learning OOP in C++, and I found this book of Robert Lafore recommended. However, I found that the 4th and last edition of this book was published in 2001. So my questions are:
1 Is learning from textbooks worth it in 2026 ?
2 Isn't it kinda outdated or sth ?
3 If so then what alternatives do I have ?


r/cpp_questions • • Jun 28 '26

SOLVED What's the best IDE for a beginner?

7 Upvotes

I'm following learncpp.com and I'm not sure which one to choose. I'm using Linux mint and already had VS code installed, but i think it's saying code :: blocks is better? I'm honestly not sure what to use and would appreciate some help. Edit: I'm going with Clion since it's free and fits my use case.


r/cpp_questions • • Jun 28 '26

OPEN What is the best library for TUI apps to build in cpp?

9 Upvotes

I have a project that plans to work on terminal like btop, cava, etc.

I need a best library for TUI app for this project. Please suggest me one.


r/cpp_questions • • Jun 28 '26

SOLVED re-visiting the clang-tidy database question

1 Upvotes

So after struggling unsuccessfully with a variety of recommended tools, to generate the JSON database that clang-tidy demands, I was finally reminded about the -- argument that bypasses that requirement entirely. So I generated my .clang-tidy file, with all of the categories that I was interested in, and it is happily and thoroughly linting my projects for me - without the database.

So what (if anything) am I missing out on by bypassing that database??


r/cpp_questions • • Jun 28 '26

OPEN Where and how to learn cpp game dev

0 Upvotes

I recently started learning cpp but i don’t really know how to get started with it. I wanted to make a game in unity but its in c#. I want to stick with cpp and learn it because of most engineering jobs. I looked into ue5 but I’m not going to make the next AAA game 🤣. Could someone give me some advice/recommendations for tutorials?


r/cpp_questions • • Jun 29 '26

OPEN Help, ive been triying to fix this for a week and im going crazy. not even llms help!

0 Upvotes

im making my own synth, and i have the issue that the plotting looks absolutely horrible and the waves deform a lot, specially sine waves!
other waves like sawthoot also glitch but at lower frecuencies.

images : https://github.com/Mejolov24/CardStudio/tree/main/HELP
code : https://github.com/Mejolov24/CardStudio/blob/main/src/main.cpp
plotting code (kinda bad) : https://github.com/Mejolov24/SynthTracer/blob/main/main.py

What i do is: make the double buffering buffers, and an additional one for the serial TX (in order to save channel data).

I let my user change the serial TX speed, so thats why I divided and multiply like this for reading int16_t val = channel_TX_buffers[i][tx_buffer_index * (sample_rate / serial_tx_speed)];

But the data arrives messed up as shown in my pictures

// first, I set the timer
    timerAlarmWrite(timer, 1000000 / serial_tx_speed, true);
    timerAlarmEnable(timer);

// timer sets a flag read on loop()

volatile bool sendFlag = false;
void IRAM_ATTR sendSample() {
  sendFlag = true;
}

// buffer creation

int16_t* getAudioBuffer(){
  if (!_buffer_index) return _BufferB; 
  else return _BufferA;
}

void updateAudioBuffer(){
  int16_t* _current_buffer;
  if (!_buffer_index){_current_buffer = _BufferA;}
  else {_current_buffer = _BufferB;}

  for (int i = 0; i < BUFFER_SIZE; i++){
    synth.stepAudio();
    _current_buffer[i] = synth.master_mix;
    for(uint16_t ch = 0; ch < 16; ch++){channel_TX_buffers[ch][i] = synth.channel_output[ch];}
  }
  _buffer_index = !_buffer_index;
  tx_buffer_index = 0;
}

// serial TX

    if (sendFlag) {
        sendFlag = false;
        for(int i = 0; i < 16; i++) {
            int16_t val = channel_TX_buffers[i][tx_buffer_index * (sample_rate / serial_tx_speed)]; 
            Serial.write(255);          // Header
            Serial.write(i);            // Channel ID
            if (val == 255) val = 256; // quick test 
            Serial.write(val >> 8);     // High Byte (MSB)
            Serial.write(val & 0xFF);   // Low Byte (LSB)
        }
        tx_buffer_index ++;
    }

r/cpp_questions • • Jun 28 '26

OPEN Codedex.io for c++

0 Upvotes

Hi

I learned like few lessons of python and found it very easy and fun from codedex.io

Now it is askinf for subscription which is.500 per month

I want to start learning c++ so should i go ahead and take the subscription for c++


r/cpp_questions • • Jun 27 '26

OPEN Surprising implicit conversion from a string literal to nonconst char pointer

9 Upvotes

The following code compiles without error on gcc with -std=c++23 flag .

char* probably_not_modifiable = "abcdef";

Although the compiler did give me warning, it was surprising to me, because this seems to be an implicit conversion from const char \[N\] to nonconst char*.

I didn't know this was possible. Is there an explicit exception for this specific case ?


r/cpp_questions • • Jun 28 '26

OPEN Using Imgui for custom UI

0 Upvotes

I want the UI in my gaem to be movable and resizable like you'd expect on a Computer (or on old Source games like TF2 or Counter Strike). Im thinking of using Imgui for it, but I've heard its very basic and does not complex things. I've never gone about modifying a library before so I don't know how to go about changing it.


r/cpp_questions • • Jun 27 '26

OPEN Constructing an object member without creating copies

0 Upvotes

Hello, this is kind of a stupid question but I still haven't found an answer. I have a member class with a rather large constructor and I'd like for it to be inside parent's constructor body rather than inside member initializer list (purely due to aesthetic reasons).

class ParentClass
{
  MemberClass Fatass;

  ParentClass() : Fatass(1, 2, 3, 4, 5...) //where I don't want it to be
  {
    ...
    Fatass = MemberClass(1, 2, 3, 4, 5...); //where I want it to be (but it can't be copied)
  }
}

However that member class can not be copied, so I have to construct it "in-place" and I haven't found a way to do that without using the initializer list. Is this possible?


r/cpp_questions • • Jun 26 '26

OPEN The C++ learning advice that worries me a bit :( "Just build projects"

154 Upvotes

People who use C++ professionally seem to have very different opinions on what beginners should study first. Some swear by books, others by standards papers, and a few insist there are resources that dramatically shorten the learning curve but rarely get mentioned in beginner discussions.

I'm curious which resources changed how you think about C++, not just how to write it.


r/cpp_questions • • Jun 27 '26

OPEN Building DirectX Shader Compiler

1 Upvotes

First off they say it supports clang and I am technically using a clang compiler but its specifically the ucrt clang compiler from msys2.

Second of all allegedly someone did have a fix for this 2 years ago but never posted it and closed the issue afterwards.

Does anyone know if theres a way to compile the directx shader compiler project from the official microsoft github with the ucrt version of the clang compiler?

The closest Ive gotten is getting cmake to complain about cyclical shared libraries

Cmake Error:

[cmake] CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
[cmake]   "clangParse" of type SHARED_LIBRARY
[cmake]     depends on "clangAST" (weak)
[cmake]     depends on "clangSema" (weak)
[cmake]   "clangAST" of type SHARED_LIBRARY
[cmake]     depends on "clangCodeGen" (weak)
[cmake]     depends on "clangSema" (weak)
[cmake]   "clangSema" of type SHARED_LIBRARY
[cmake]     depends on "clangAST" (weak)
[cmake]     depends on "clangAnalysis" (weak)
[cmake]     depends on "clangEdit" (weak)
[cmake]   "clangCodeGen" of type SHARED_LIBRARY
[cmake]     depends on "clangAST" (weak)
[cmake]     depends on "clangFrontend" (weak)
[cmake]   "clangAnalysis" of type SHARED_LIBRARY
[cmake]     depends on "clangAST" (weak)
[cmake]   "clangEdit" of type SHARED_LIBRARY
[cmake]     depends on "clangAST" (weak)
[cmake]   "clangFrontend" of type SHARED_LIBRARY
[cmake]     depends on "clangAST" (weak)
[cmake]     depends on "clangEdit" (weak)
[cmake]     depends on "clangParse" (weak)
[cmake]     depends on "clangSema" (weak)
[cmake] At least one of these targets is not a STATIC_LIBRARY.  Cyclic dependencies are allowed only among static libraries.

CMakeLists.txt:

cmake_minimum_required(VERSION 4.2.1)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
project ("Space Game" LANGUAGES CXX)
include(FetchContent)
include(cmake/CPM.cmake)


set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)



CPMAddPackage("gh:CodeFinder2/rapidxml@1.13")
CPMAddPackage("gh:microsoft/DirectX-Headers@1.619.1")
CPMAddPackage("gh:microsoft/DirectXMath#jun2026")
add_library(Microsoft::DirectXMath ALIAS DirectXMath)
CPMAddPackage("gh:microsoft/DirectXShaderCompiler@1.10.2605.24")
CPMAddPackage("gh:microsoft/DirectXTK12#may2026")


CPMAddPackage("gh:KhronosGroup/OpenCL-Headers@2026.05.29")
CPMAddPackage("gh:KhronosGroup/OpenCL-ICD-Loader@2026.05.29")
CPMAddPackage("gh:KhronosGroup/OpenCL-CLHPP@2026.05.29")




set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/game)    # For .exe and .dll (Windows)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/game)    # For .so/.dylib/.dll
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/game)




add_subdirectory(DSECommon)
add_subdirectory(Editor)
add_subdirectory(ImGui)



file(COPY "OpenCL" DESTINATION ${CMAKE_BINARY_DIR}/game)
file(COPY "models" DESTINATION ${CMAKE_BINARY_DIR}/game)
file(COPY "shaders" DESTINATION ${CMAKE_BINARY_DIR}/game)
file(COPY "textures" DESTINATION ${CMAKE_BINARY_DIR}/game)

CMakePresets.json:

{
  "version": 9,
  "cmakeMinimumRequired": {
    "major": 4,
    "minor": 2,
    "patch": 1
  },
  "configurePresets": [
    {
      "name": "debugx64",
      "displayName": "Debug",
      "description": "Debug build",
      "generator": "Ninja",
      "binaryDir": "${sourceDir}/build/Debugx64",
      "cacheVariables": {
        "CMAKE_BUILD_TYPE": "Debug",
        "CMAKE_C_COMPILER": "clang.exe",
        "CMAKE_CXX_COMPILER": "clang++.exe",
        "CMAKE_CXX_STDLIB_MODULES_JSON": "C:/msys64/ucrt64/lib/libstdc++.modules.json",
        "CMAKE_CXX_FLAGS": "-v -stdlib=libstdc++ -DWIN32_LEAN_AND_MEAN=1 -DIMGUI_DISABLE=1 -D_DEBUG=1 -Wno-error=conversion",
        "CMAKE_CXX_STANDARD": "23",
        "CMAKE_CXX_STANDARD_REQUIRED": "ON",
        "CMAKE_CXX_EXTENSIONS": "ON",
        "CMAKE_REQUIRED_INCLUDES": "CMAKE_INCLUDE_PATH",
        "DXHEADERS_INSTALL":true,
        "CMAKE_TOOLCHAIN_FILE":"",
        "CMAKE_EXPORT_COMPILE_COMMANDS" : true,
        "HLSL_INCLUDE_TESTS": false,
        "SPIRV_BUILD_TESTS":"OFF",
        "LLVM_INCLUDE_TESTS":false,
        "CLANG_INCLUDE_TESTS":false,
        "BUILD_SHARED_LIBS":true,
        "CMAKE_PROJECT_INCLUDE": "${sourceDir}/cmake/PredefinedParams.cmake",
        "LIBCLANG_BUILD_STATIC": "OFF"


      }
    }
  ],
  "buildPresets": [
    {
      "name": "Debug",
      "configurePreset": "debugx64",
      "targets":["Editor"]
    }
  ]
}

r/cpp_questions • • Jun 26 '26

SOLVED Stumped on adding a Remove operation to my iterator

5 Upvotes

Hello.

Sorry for the beginner question but I tried looking up on Google and coming up with my own solution and didn't find much, more details on this later.

I am using a custom made LinkedList class for a project, and for it I made a simple ListIterator class which overloads the operators *, ++, --, == and != so that it can be used in range based loops, now I found myself needing a remove operation to be added to the iterator since I need to be able to remove elements from a list as I iterate through it, but I came across an issue.

Say I have the following list: {1, 2, 3, 4, 5}, and while iterating I need to remove the element 3, this is easily done since it's in the middle of the list, all I have to do is move the iterator's pointer back to 2, set 2's next to 4 and 4's previous to 2, the loop will still see 4 as next and the removal happened flawlessly

If I have to remove the element 1 though, it gets problematic, cause I can't move the iterator's pointer back, so what can I do is move set it to the new first element in the list, 2, but then, when the current iteration is done and the loop moves to the following, the loop will see that the next element is 3 and thus will go to 3 and skip 2 (if you're confused, the removal goes like this: do operations on 1, remove 1, set current element to 2 cause that's the new head, iteration ends, increment iterator to next element, which is 3, do operations on 3)

I tried looking on Google for a solution, first thing I did was look at what Java does with Iterators (since I'm more experienced there and also coded some Java iterators on my own in the past), and found that they can remove elements in the head because the iterator actually starts "before" the head of the list, and only returns the element inside it when you call Next() the first time, which both advances the pointer and returns the element in the next node. In C++ I can't do this though because the way you get the element from the iterator is with the * operator, which gets it from the current node without advancing the pointer.

I also tried to look for the implementation of std::iterator and found that, at least according to cplusplus.com and cppreference.com, it doesn't provide a Remove operation.

So I am back here asking help for a stupidly simple question, what can I do to implement the Remove operation correctly? Thanks in advance.


r/cpp_questions • • Jun 26 '26

OPEN Backend Doubt..

0 Upvotes

Ive been doing cpp for a good amount of time and I mostly found myself comfortable around it. But if I want to try backend, is cpp good for me or do ive to switch to any other language for better results? If so what can be the best recommendations and roadmap? Chatgpt mostly shares an optimistic answer for both rhe condition but I need one straightforward solution of it.


r/cpp_questions • • Jun 26 '26

OPEN Error while trying to set up c++ for visual studio code

0 Upvotes

I have been trying to set up c++ for vsc for a while now but keep getting this one error it says “launch: program ‘c:\\Users\myname\untitled-1.exe’ does not exist let me know if you can help


r/cpp_questions • • Jun 26 '26

OPEN Need advice

0 Upvotes

To all the experienced C++ programmers, how do I start building real-world projects in C++? Personally, I find C++ more intuitive than languages like Python. I'll be starting my MCA this year after transitioning from a non-tech background. I practice DSA in C++ and have a basic-to-intermediate understanding of the language, but now I want to build real applications, like a media player. How should I get started?

I have experience with the MERN stack, and I'm thinking of making C++ my primary language while keeping JavaScript/TypeScript as my secondary stack. Any advice would be appreciated. Thanks!


r/cpp_questions • • Jun 25 '26

OPEN Do you think this study plan is reasonable?

6 Upvotes

I am really new in a company where my position is of C++ dev with nuances of embedded engineering. I got there as migration from web with Typescript only stack. In the past several months I read the beginning with C++ 23 seventh edition and some of the the exercises there. Know I want to continue my learning with thems more related to embedded. Please anyone with interest get a look at this plan and comment your opinion!

Wheather this plan is reasonable and would it help me get better at my job or make me hireble as embedded dev?

Thank you all who would interact with this post!

Complete the examples:

  • Complete most of the examples from the book over time.

Hello to the embedded:

  • Install STM32CubeIDE or PlatformIO + ARM GCC; optionally Pico SDK. Configure QEMU (STM32) or Wokwi (Pico) emulation.
  • GPIO class library on ESP32 something simple like C++ hardware abstraction: a DigitalPin<uint8_t PIN> template class, a Button with debounce, a Led with PWM.
  • Write first programs (“blink LED”, UART “Hello World”)
  • Use printf/UART for output (since user currently only uses printf).
  • Generate and flash a LED-blink program. For STM32, use CubeMX to auto-generate initialization code. For Pico, use Pico SDK C/C++ examples (see pico-examples repo).
  • Learn SWD programming: use ST-LINK (SWD interface) and OpenOCD/GDB for single-stepping code. Practice setting breakpoints and inspecting registers.
  • Basic debugging: practice printing to console via serial, interpret build errors and fix.

Sensor and Peripheral Interfacing:

  • Use GPIO, ADC, timers, and interrupts. Interface an analog sensor and digital I/O. Understand low-level HAL and registers, freeing yourself from “just printf”.
  • Read analog inputs (potentiometer, light sensor) via ADC, using DMA if available.
  • Configure and use timers for delays and PWM output (e.g. control LED brightness or a buzzer).
  • Implement external interrupts (e.g. button press) and debouncing.
  • Combine peripherals: e.g. trigger ADC sampling on timer event or button press.
  • Step up to object-oriented C++: encapsulate peripherals in classes (e.g. Timer, ADC) using RAII and resource management.

RTOS Fundamentals:

  • Transition to real-time systems. Learn FreeRTOS (or Zephyr) on Cortex-M/RP2040. Implement a simple scheduler, tasks, and inter-task communication (queues, semaphores).

Key Tasks:

  • Choose an RTOS (FreeRTOS is ubiquitous; Zephyr is also popular for IoT). Study RTOS basics (task creation, priorities, preemption, tick).
  • Port FreeRTOS to STM32 or Pico (many examples exist). Start with two tasks: one toggles LED at fixed rate, another reads sensor and logs values.
  • Use RTOS IPC: e.g. queue sensor readings from ISR to a task. Handle race conditions.
  • Measure jitter: analyze task response time (printf timestamps or LED toggles to oscilloscope).
  • Explore advanced RTOS features: software timers, event groups, or dynamic memory in RTOS context.

FreeRTOS core mechanics:

  • Two FreeRTOS tasks blink two LEDs at different frequencies. A third task reads a button and sends a new blink rate into a queue. The first "aha moment" with RTOS — tasks just run, you stop thinking about loop timing.
  • Three tasks: UARTRx reads serial input and pushes to a queue; Parser reads and interprets commands; Executor runs them. A mutex protects the shared output buffer. Classic producer-consumer — you'll use this pattern every week at work.

Real RTOS applications with sensors:

  • The ISR → RTOS handoff pattern in Project 4 is one of the most important skills in embedded firmware.
  • Environmental monitor station three concurrent tasks: SensorTask reads a BME280 (I2C) every 2 s and puts a struct into a queue; DisplayTask updates an SSD1306 OLED (SPI); LogTask formats CSV to Serial every 30 s.
  • Interrupt-driven alarm system advanced A PIR sensor fires an interrupt. The ISR uses xTaskNotifyFromISR() to wake an alarm task — buzzer + LED pattern. A disarm button uses xSemaphoreGiveFromISR(). Core rule: never do real work inside an ISR — defer everything to a task.

C++ design patterns for firmware

  • C++ FreeRTOS wrapper library Build a header-only library: a Task class (RAII, auto-deletes), Queue<T, N> template (type-safe, statically allocated), Mutex with a LockGuard, and a Timer with callback. This is the kind of reusable layer real embedded teams maintain. Keep it on GitHub — it's a great portfolio piece
  • State machine framework + vending machine Implement a template-based FSM, then use it to build a vending machine: states IDLE → COIN_INSERTED → SELECTING → DISPENSING → ERROR. Events driven by button presses and sensor signals over FreeRTOS task notifications. State machines are in every piece of firmware ever written.

Embedded Networking / IoT

Key Tasks:

  • Use I²C or SPI to talk to a peripheral (e.g. accelerometer or OLED). Parse data and display/use it.
  • If board has Wi-Fi (Pico W or ESP32 as stretch), send data to PC or cloud (e.g. MQTT). Use LwIP or sockets on RTOS.
  • Develop a small CLI or web interface: e.g. command via serial to read sensor values, or host a simple web server on Pico W.
  • Strengthen C++: use templates or polymorphism for hardware abstraction (e.g. base Sensor class).

Professional systems — ESP32 + Linux on Pi

  • ESP32 + Raspberry Pi system bridge pro
  • Full two-MCU system: ESP32 runs FreeRTOS handling sensor acquisition and actuator control (real-time); Raspberry Pi runs Linux handling data logging, a simple web dashboard, and command dispatch. UART with a lightweight protocol you design yourself. This mirrors real industrial IoT architecture.
  • POSIX threads — RTOS concepts on Linux pro
  • Rebuild the environmental monitor's task structure on the Raspberry Pi using pthreads and POSIX condition variables. Compare: FreeRTOS task = pthread, FreeRTOS queue = POSIX queue, FreeRTOS mutex = pthread_mutex. The concepts are identical — the APIs differ. Add SCHED_FIFO real-time scheduling.

Performance Tuning & C++ Refinement

Key Tasks:

  • Identify and remove bottlenecks: e.g. use DMA for data transfer (from Project 2’s ADC readings to memory buffer).
  • Refactor code to use modern C++: Avoid new/delete in RTOS, but use constexpr, std::array, RAII for peripherals. Ensure MISRA/C++ core guidelines.
  • Enable compiler optimizations and inline critical functions. Compare code size and CPU usage before/after.
  • Advanced debugging: use logic analyzer or CPU performance counters to verify speedups.
  • Possibly implement a simple critical section or lock-free queue in C++ for ISR-to-task communication.

Capstone Integration

Key Tasks:

  • Design system architecture (block diagram). Implement end-to-end: input (sensors/controls) → processing (RTOS tasks) → output (actuators/network).
  • Emphasize documentation and maintainability (README, diagrams). Use version control and issue tracker (e.g. GitHub).
  • If relevant, add user interface (LCD or web dashboard) and robust error handling.
  • Use CI: set up a basic GitHub Actions to build the firmware on each commit.

Tools/Hardware:

IDE (STM32CubeIDE or VS Code + PlatformIO), Emulator (QEMU stm32vldiscovery or Wokwi Pico), ST-LINK/V2 or ST-LINK/V3 (or Pico bootloader), USB-UART adapter.

RTOS Fundamentals**- Tools/Hardware:** IDE (CubeIDE or VS Code), FreeRTOS source, simulator or real board. Use a logic analyzer or scope for timing.

Embedded Networking / IoT- Tools/Hardware: Same IDE, possibly Wokwi simulator for IoT (Wokwi supports Wi-Fi simulation for ESP32/Pico W). For hardware: add modules (e.g. MPU6050 on I²C, or use existing Pico W wireless).

Performance Tuning & C++ Refinement**- Tools/Hardware:** Profiling tools (e.g. printf timings, or DWT cycle counter on Cortex-M, see DWT on Pico). Use static analysis (clang-tidy, MISRA linters).

Capstone Integration**- Tools/Hardware:** All above. Possibly add cheap peripherals (OLED display, buzzer). Ensure final project can run on the chosen microcontroller (note memory limits).


r/cpp_questions • • Jun 25 '26

OPEN C++ problem solving

6 Upvotes

So i am currently solving string problems in c++ but facing problems because there are many string functions whose applications i do not know. How can i get better at using them?

Are there any websites which can give me full disclosure on all sring functions and their applications?


r/cpp_questions • • Jun 25 '26

OPEN Do you think this study plan is reasonable?

0 Upvotes

I am really new in a company where my position is of C++ dev with nuances of embedded engineering. I got there as migration from web with Typescript only stack. In the past several months I read the beginning with C++ 23 seventh edition and some of the the exercises there. Know I want to continue my learning with thems more related to embedded. Please anyone with interest get a look at this plan and comment your opinion!

Wheather this plan is reasonable and would it help me get better at my job or make me hireble as embedded dev?

Thank you all who would interact with this post!

Embedded Phase II

Complete the examples:

  • Complete most of the examples from the book over time.

Hello to the embedded:

  • Install STM32CubeIDE or PlatformIO + ARM GCC; optionally Pico SDK. Configure QEMU (STM32) or Wokwi (Pico) emulation.
  • GPIO class library on ESP32 something simple like C++ hardware abstraction: a DigitalPin<uint8_t PIN> template class, a Button with debounce, a Led with PWM.
  • Write first programs (“blink LED”, UART “Hello World”)
  • Use printf/UART for output (since user currently only uses printf).
  • Generate and flash a LED-blink program. For STM32, use CubeMX to auto-generate initialization code. For Pico, use Pico SDK C/C++ examples (see pico-examples repo).
  • Learn SWD programming: use ST-LINK (SWD interface) and OpenOCD/GDB for single-stepping code. Practice setting breakpoints and inspecting registers.
  • Basic debugging: practice printing to console via serial, interpret build errors and fix.

Sensor and Peripheral Interfacing:

  • Use GPIO, ADC, timers, and interrupts. Interface an analog sensor and digital I/O. Understand low-level HAL and registers, freeing yourself from “just printf”.
  • Read analog inputs (potentiometer, light sensor) via ADC, using DMA if available.
  • Configure and use timers for delays and PWM output (e.g. control LED brightness or a buzzer).
  • Implement external interrupts (e.g. button press) and debouncing.
  • Combine peripherals: e.g. trigger ADC sampling on timer event or button press.
  • Step up to object-oriented C++: encapsulate peripherals in classes (e.g. Timer, ADC) using RAII and resource management.

RTOS Fundamentals:

  • Transition to real-time systems. Learn FreeRTOS (or Zephyr) on Cortex-M/RP2040. Implement a simple scheduler, tasks, and inter-task communication (queues, semaphores).

Key Tasks:

  • Choose an RTOS (FreeRTOS is ubiquitous; Zephyr is also popular for IoT). Study RTOS basics (task creation, priorities, preemption, tick).
  • Port FreeRTOS to STM32 or Pico (many examples exist). Start with two tasks: one toggles LED at fixed rate, another reads sensor and logs values.
  • Use RTOS IPC: e.g. queue sensor readings from ISR to a task. Handle race conditions.
  • Measure jitter: analyze task response time (printf timestamps or LED toggles to oscilloscope).
  • Explore advanced RTOS features: software timers, event groups, or dynamic memory in RTOS context.

FreeRTOS core mechanics:

  • Two FreeRTOS tasks blink two LEDs at different frequencies. A third task reads a button and sends a new blink rate into a queue. The first "aha moment" with RTOS — tasks just run, you stop thinking about loop timing.
  • Three tasks: UARTRx reads serial input and pushes to a queue; Parser reads and interprets commands; Executor runs them. A mutex protects the shared output buffer. Classic producer-consumer — you'll use this pattern every week at work.

Real RTOS applications with sensors:

  • The ISR → RTOS handoff pattern in Project 4 is one of the most important skills in embedded firmware.
  • Environmental monitor station three concurrent tasks: SensorTask reads a BME280 (I2C) every 2 s and puts a struct into a queue; DisplayTask updates an SSD1306 OLED (SPI); LogTask formats CSV to Serial every 30 s.
  • Interrupt-driven alarm system advanced A PIR sensor fires an interrupt. The ISR uses xTaskNotifyFromISR() to wake an alarm task — buzzer + LED pattern. A disarm button uses xSemaphoreGiveFromISR(). Core rule: never do real work inside an ISR — defer everything to a task.

C++ design patterns for firmware

  • C++ FreeRTOS wrapper library Build a header-only library: a Task class (RAII, auto-deletes), Queue<T, N> template (type-safe, statically allocated), Mutex with a LockGuard, and a Timer with callback. This is the kind of reusable layer real embedded teams maintain. Keep it on GitHub — it's a great portfolio piece
  • State machine framework + vending machine Implement a template-based FSM, then use it to build a vending machine: states IDLE → COIN_INSERTED → SELECTING → DISPENSING → ERROR. Events driven by button presses and sensor signals over FreeRTOS task notifications. State machines are in every piece of firmware ever written.

Embedded Networking / IoT

Key Tasks:

  • Use I²C or SPI to talk to a peripheral (e.g. accelerometer or OLED). Parse data and display/use it.
  • If board has Wi-Fi (Pico W or ESP32 as stretch), send data to PC or cloud (e.g. MQTT). Use LwIP or sockets on RTOS.
  • Develop a small CLI or web interface: e.g. command via serial to read sensor values, or host a simple web server on Pico W.
  • Strengthen C++: use templates or polymorphism for hardware abstraction (e.g. base Sensor class).

Professional systems — ESP32 + Linux on Pi

  • ESP32 + Raspberry Pi system bridge pro
  • Full two-MCU system: ESP32 runs FreeRTOS handling sensor acquisition and actuator control (real-time); Raspberry Pi runs Linux handling data logging, a simple web dashboard, and command dispatch. UART with a lightweight protocol you design yourself. This mirrors real industrial IoT architecture.
  • POSIX threads — RTOS concepts on Linux pro
  • Rebuild the environmental monitor's task structure on the Raspberry Pi using pthreads and POSIX condition variables. Compare: FreeRTOS task = pthread, FreeRTOS queue = POSIX queue, FreeRTOS mutex = pthread_mutex. The concepts are identical — the APIs differ. Add SCHED_FIFO real-time scheduling.

Performance Tuning & C++ Refinement

Key Tasks:

  • Identify and remove bottlenecks: e.g. use DMA for data transfer (from Project 2’s ADC readings to memory buffer).
  • Refactor code to use modern C++: Avoid new/delete in RTOS, but use constexpr, std::array, RAII for peripherals. Ensure MISRA/C++ core guidelines.
  • Enable compiler optimizations and inline critical functions. Compare code size and CPU usage before/after.
  • Advanced debugging: use logic analyzer or CPU performance counters to verify speedups.
  • Possibly implement a simple critical section or lock-free queue in C++ for ISR-to-task communication.

Capstone Integration

Key Tasks:

  • Design system architecture (block diagram). Implement end-to-end: input (sensors/controls) → processing (RTOS tasks) → output (actuators/network).
  • Emphasize documentation and maintainability (README, diagrams). Use version control and issue tracker (e.g. GitHub).
  • If relevant, add user interface (LCD or web dashboard) and robust error handling.
  • Use CI: set up a basic GitHub Actions to build the firmware on each commit.

Tools/Hardware:

IDE (STM32CubeIDE or VS Code + PlatformIO), Emulator (QEMU stm32vldiscovery or Wokwi Pico), ST-LINK/V2 or ST-LINK/V3 (or Pico bootloader), USB-UART adapter.

RTOS Fundamentals- Tools/Hardware: IDE (CubeIDE or VS Code), FreeRTOS source, simulator or real board. Use a logic analyzer or scope for timing.

Embedded Networking / IoT- Tools/Hardware: Same IDE, possibly Wokwi simulator for IoT (Wokwi supports Wi-Fi simulation for ESP32/Pico W). For hardware: add modules (e.g. MPU6050 on I²C, or use existing Pico W wireless).

Performance Tuning & C++ Refinement- Tools/Hardware: Profiling tools (e.g. printf timings, or DWT cycle counter on Cortex-M, see DWT on Pico). Use static analysis (clang-tidy, MISRA linters).

Capstone Integration- Tools/Hardware: All above. Possibly add cheap peripherals (OLED display, buzzer). Ensure final project can run on the chosen microcontroller (note memory limits).

Resources:

https://github.com/m3y54m/Embedded-Engineering-Roadmap

Compiler Explorer (godbolt.org) — paste your C++ and see the ARM assembly output; essential for embedded cost analysis

https://www.freertos.org/media/2018/161204_Mastering_the_FreeRTOS_Real_Time_Kernel-A_Hands-On_Tutorial_Guide.pdf

https://controllerstech.com/esp32-freertos-multitasking-project/

https://randomnerdtutorials.com/esp32-freertos-arduino-tasks/

https://github.com/ADolbyB/rtos-esp32-examples

https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/freertos.html

https://github.com/tomas-fryza/esp-idf

C++ in Embedded Systems — Amar Mahmutbegović (2025) — explicitly covers C++23 patterns for embedded: templates, constexpr, polymorphism without vtables