Skip to main content
1 vote
1 answer
184 views

What determines the order of initialization of static variables in class templates? Consider for example the program as follows: #include <iostream> int f() { static int s = 0; return ++s; } ...
Fedor's user avatar
  • 24.9k
4 votes
1 answer
404 views

According to some modern C++ guidelines, we should prefer uniform initialization everywhere, for example: int x{0}; However, when I try to combine uniform initialization with C++20’s designated ...
rafoo's user avatar
  • 1,708
5 votes
0 answers
233 views

I am writing an embedded OS to run on Risc-V. As part of that, I'm implementing a FIFO for UART buffering using the classic single consumer/single producer module. The class looks like this: template &...
Shachar Shemesh's user avatar
1 vote
2 answers
315 views

So there is a phrase from the C++ Standard working draft (n4928): [dcl.init.general] ¶ 16.6.1 If the initializer expression is a prvalue and the cv-unqualified version of the source type is the same ...
Eugene Zavidovsky's user avatar
0 votes
0 answers
48 views

I'm very very new to C++ so I hope this question does make sense and is not too ill formed. From my understanding, the uniform initialization {} should forbid any narrowing conversion. So for example ...
Pickman02's user avatar
  • 101
0 votes
1 answer
107 views

I'm using video_player: ^2.10.0 to display a video as a background in my web app, but it is simply not loading. There is this Video init error: UnimplementedError: init() has not been implemented. I ...
Mian Faseeh's user avatar
0 votes
1 answer
28 views

I have a script in Gtree with GAMS on the carry-over effect on groundwater. I initialised the groundwater depth in the year 2000, and then I need to use the end-of-the-year groundwater depth as a ...
Thomas's user avatar
  • 501
9 votes
4 answers
1k views

I used malloc to define an index because each line had a different number of elements (simplified example below): int** Index=malloc(2*sizeof(int*)); Index[0]=malloc(2*sizeof(int)); Index[1]=malloc(3*...
Anonymus Anonyma's user avatar
5 votes
2 answers
395 views

Consider this code: int foo() { goto lbl; int a = 4; lbl: return 5; } With GCC 12, this compiles totally fine as C, not even a warning. However if I try to compile it as C++ I get this ...
Timmmm's user avatar
  • 99.3k
3 votes
2 answers
234 views

C++26 introduces "erroneous behaviour" for uninitialised data, and introduces the [[indeterminate]] attribute for locals to restore the pre-C++26 behaviour as needed. I want to get ...
sh1's user avatar
  • 5,020
0 votes
0 answers
106 views

I’m trying to understand the rationale behind the Linux kernel’s initcall mechanism. My current understanding: Kernel subsystems expose one-time initialization functions using macros like ...
void_brain's user avatar
2 votes
1 answer
121 views

I would like to initialize a NULL terminated array of pointer to struct using compound literals. Currently, I achieve this by: struct object { int data1; char data2; }; struct object *...
WalrusDevil's user avatar
2 votes
1 answer
104 views

While reviewing some testing code, I have come across this situation: Suppose we have these two classes: class Project { public: Project(std::string path); ~Project; // [many more ...
perivesta's user avatar
  • 4,188
0 votes
0 answers
55 views

I am new to Pytest and Python. I tried to run some test with Pytest but I got this error: OS: Windows 11 Home Python version:3.13.5 Pytest version:8.4.1 The command I tried to run is PS C:\Users\xxxx\...
user30965980's user avatar
1 vote
3 answers
224 views

In C++, how can one programmatically determine whether an object is default-initialized or left uninitialized — without relying on reading the standard, documentation, or source code? For example: int ...
toliveira's user avatar
  • 1,867

15 30 50 per page
1
2 3 4 5
789