Skip to main content
Filter by
Sorted by
Tagged with
1 vote
4 answers
189 views

As far as I understand, you are allowed to access inactive members of a union, if they share a "common initial sequence" with an active one. This can be used to tag active member with a type ...
Dominik Kaszewski's user avatar
0 votes
0 answers
71 views

I am trying to retrieve the SMART Data of an external SATA SSD wchar_t path[64]; swprintf_s(path, _countof(path), L"\\\\.\\PhysicalDrive%d", 0); HANDLE hDrive = CreateFile(path, GENERIC_READ ...
David Hu's user avatar
Advice
0 votes
2 replies
100 views

I'm trying to build my own handheld games console similar to a gameboy. Currently for the POC im using the Arduino Uno, seperate SD Card Reader Module and 2.4 inch TFT Display. I want to put the game ...
user15155666's user avatar
2 votes
1 answer
101 views

I have the below code I want to print Use skeleton! if SKELETON_ENABLED is defined and is not running on MAC OS, and Don't use skeleton!\n otherwise. The program prints Don't use skeleton!\n, even ...
User's user avatar
  • 25
0 votes
1 answer
70 views

I'm using STM32F103C8T6 to receive the signal from INMP441 with I2S. Using Standard Periph Library with keilC. I configured GPIO, I2S, Usart, I want to get data from INMP441 then send it to esp32 ...
Do Quang Vinh's user avatar
Advice
0 votes
4 replies
137 views

I recently had an interview where I was asked to show how to prevent race conditions in C or C++ between two threads operating on shared data. I used a mutex as follows : pthread_mutex_t mutex; int ...
Engineer999's user avatar
  • 4,159
Best practices
2 votes
10 replies
274 views

In C, when I pass a pointer to a function, the compiler always seems to assume that the data pointed to by that pointer might be continuously modified in another thread, even though in actual API ...
Moi5t's user avatar
  • 465
-3 votes
1 answer
108 views

In 2021, this post here on StackOverflow: How are GCC and g++ bootstrapped? -> Andrius Strikonas' answer explained how GCC can be bootstrapped beginning with a tiny assembler taking just a hex dump ...
einpoklum's user avatar
  • 137k
3 votes
1 answer
134 views

I just installed Visual Studio 2022 and I'm trying to get an application working with a dialog box as a main window in order to make the GUI easier to produce. But the thing is that I've found nothing ...
ciddu42's user avatar
  • 63
5 votes
1 answer
104 views

I am trying to use the PETSc (Portable, Extensible Toolkit for Scientific Computation) library in Go over cgo. After the call of PetscInitialize, the program will crash at a random point with the ...
Fabian's user avatar
  • 81
2 votes
1 answer
112 views

I am trying to hide some implementation behind an opaque data type. Normally, pimpl would be the preferred pattern, but it requires heap allocation which is not desirable in this context (embedded, ...
Dominik Kaszewski's user avatar
1 vote
1 answer
56 views

I am implementing an SNMP agent on an STM32H563 using LwIP. SNMPv2c works perfectly, but SNMPv3 requests with the authPriv security level time out. On the manager's side, a request is sent with net-...
ardemit's user avatar
  • 21
-1 votes
0 answers
87 views

double amountAdd = 0; while (amountAdd <= 0) { printf("\nEnter Amount to deposit: "); scanf("%lf", &amountAdd); } In this block of ...
10 01's user avatar
  • 19
Advice
2 votes
10 replies
380 views

I'm a small-scale C programmer at the moment, and I'm bugged by the question: is Visual Studio worth the annoyance that it is? I've been programming in C and C++ in Visual Studio Code for a while, and ...
Gaspar Liboreiro's user avatar
2 votes
2 answers
183 views

I want to add a breakpoint in the line system("/path/to/world") in VS Code for debugging the /path/to/world program with gdb. Here is the source code of /path/to/hello.c: int main(int argc, ...
stackbiz's user avatar
  • 1,916
2 votes
0 answers
208 views

I am creating heap allocated memory with execute rights using windows.h VirtualAlloc and VirtualProtect. void* write_into_executable(uint8_t code[]) { SYSTEM_INFO info; GetSystemInfo(&info)...
Horlou's user avatar
  • 29
1 vote
1 answer
134 views

I'm migrating my Diffie-Hellman (DH) implementation from OpenSSL 1.1 to OpenSSL 3.0. Previously, I used APIs like DH_set0_pqg, but these are now deprecated. I am switching to the EVP_PKEY-DH interface ...
PKRG's user avatar
  • 637
-5 votes
2 answers
270 views

I want to try catch the free(hello); so that the free(world); can still be executed for freeing all allocated memory in the main program. int main() { const char *hello = "Hello World"; ...
stackbiz's user avatar
  • 1,916
-2 votes
1 answer
174 views

When trying to copy the string with strcpy, the following code will get the same result in the output. It seems the "+1" is not necessarily at all for a copied "char *" string to ...
stackbiz's user avatar
  • 1,916
20 votes
4 answers
2k views

I made a small C program that should print an emoji: #include <stdio.h> #include <windows.h> int main(void) { SetConsoleOutputCP(CP_UTF8); printf("\U0001F625\n"); // 😥 ...
Tim's user avatar
  • 325
2 votes
0 answers
75 views

I am trying to use a DS3234 with a STM32. (on STM32CubeIDE) Is answer me with some value but for some reason, Every value is divided by 2 except for the month. Second are updated every two (real)...
Thomas BRUDER's user avatar
2 votes
0 answers
112 views

Trying to figure out how the built-in JSON parser in libwebsockets works. From my understanding of the documentation, you're supposed to call lejp_parse(), giving it a JSON-formatted string and a ...
user30867107's user avatar
2 votes
0 answers
76 views

I have my extension and start background worker in the PG_init proc BackgroundWorker worker; /* set up common data for worker */ memset(&worker, 0, sizeof(worker)); snprintf(worker.bgw_name, ...
user1514692's user avatar
2 votes
1 answer
135 views

I've followed the book OS01 by Tuhdo, kind of made a simple bootloader, that loads the kernel. Then I tried to add some code to set up GDT, but I've witnessed unusual behavior in gdb. Here I stopped ...
nhanphamdev's user avatar
3 votes
3 answers
166 views

The lib folder contains many *.h and *.c files, and all files are in development phrase and they contain many errors including syntax errors. So I want to write the Makefile to debug all libraries one ...
stackbiz's user avatar
  • 1,916