Skip to main content
7 votes
4 answers
355 views

After running this program (compiled with MSVC compiler 19.50.35723 with option /std:c++23preview) #include <print> #include <chrono> #include <string> int main() { using ...
Angle.Bracket's user avatar
8 votes
1 answer
269 views

While compiling this snippet import std; int main() { printf("%s", "hello"); return 0; } using MS VS C++ compiler 19.50 with /std:c++23preview I got the expected error ...
Angle.Bracket's user avatar
5 votes
1 answer
144 views

A colleague of mine showed me a program with explicit object parameter in a lambda function. The program is accepted by two compilers, but produces a strange result: struct A { int a = 2; ...
Fedor's user avatar
  • 25.1k
14 votes
1 answer
1k views

From https://godbolt.org/z/bnzzMn8nK: // Example program #include <iostream> #include <string> namespace bar { template<typename T> concept has_foo = std::same_as<std::true_type, ...
Feuerteufel's user avatar
6 votes
1 answer
199 views

Consider the following code: #include <print> int main() { std::println("hello from {}", "me"); return 0; } On x86-64 this outputs hello from me. But on ARM64 it ...
Johan's user avatar
  • 77.5k
Best practices
0 votes
21 replies
146 views

I am working in an microcontroller / embedded environment which relies on global variables. Some of these global variables have non-trivial constructors and destructors, and suffers from the static ...
marco9999's user avatar
2 votes
1 answer
77 views

I'm currently building an expression parser in Boost.Parser. It should be able to do Parentheses ( ( ... ) ) and abs ( | ... |) Unary minus Power ( x^y) (other arithmetic operations, not relevant for ...
Frederic Schönberger's user avatar
2 votes
0 answers
170 views

I'm eager to compile programs with C++23 import std like import std; int main() { std::cout << "Hello, modules!\n"; } using MinGW (g++15.1 or higher) with CMake (4.1 or higher). ...
René Richter's user avatar
13 votes
1 answer
420 views

In my multithreaded program, I needed to find out from one thread the current location (stack trace) of another thread whose thread id is known. I implemented the following solution. At startup, the ...
d7d1cd's user avatar
  • 561
4 votes
1 answer
166 views

Recently I've decided to "modularize" my library. No success. Here is the repo where you can find CMakeLists.txt & CMakePresets.json: kissra (GitHub) The issue is that CMake cannot find ...
Dmitry Katkevich's user avatar
13 votes
3 answers
803 views

This code fails because the compiler thinks template arguments for Test is an empty set. #include <tuple> template <typename... T> class Test { public: template <typename Arg, ...
Dmitry's user avatar
  • 1,779
12 votes
2 answers
1k views

It is easy to iterate std::map and update values: #include <iostream> #include <map> int main() { std::map<int, int> m; m[1] = 2; m[2] = 4; for (auto &[k, v] : m)...
Fyodor Menshikov's user avatar
Best practices
0 votes
11 replies
228 views

first I must says that I hate templates.... it makes unreadable complex code.... not speaking about 5000000 lines long error messages, with 10000 possibilities and that takes ages to understand for ...
delab's user avatar
  • 1
6 votes
1 answer
136 views

[stdatomics.h.syn] specifies the following: template<class T> using std-atomic = std::atomic<T>; // exposition only #define _Atomic(T) std-atomic<T> libc++ and libstdc++ ...
Jan Schultke's user avatar
  • 44.8k
Advice
0 votes
5 replies
101 views

I wonder if using the [[assume]] attribute can have negative effects on my code, even if the expressions inside are always true. In my code, I defined the following macro: #ifdef DEBUG #include &...
PlsHelp's user avatar
  • 347

15 30 50 per page
1
2 3 4 5
45