Skip to main content
Filter by
Sorted by
Tagged with
-4 votes
0 answers
50 views

#include <stdio.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <sys/types.h> #include <netdb.h> #include &...
matthew radon's user avatar
-5 votes
0 answers
81 views

When I run this code: #include <stdio.h> #include <cs50.h> int main(void) { int counter = 0; // Initialitzate counter const int increment_every_time = get_int("What number do ...
user31972567's user avatar
2 votes
0 answers
59 views

I have 2 files: crt.c: const char service_interp[] __attribute__((section(".interp"))) = "${LD_SO}"; extern void _exit (int __status) __attribute__ ((__noreturn__)); int main(); ...
Stas Badzi's user avatar
2 votes
0 answers
67 views

I Am implementing Lockless ring buffer for multiple producer and single consumer (keeping in plan to extend it to multiple produce and consumer) using design reference of dpdk buffer : https://doc....
vinit Tirnagarwar's user avatar
1 vote
1 answer
51 views

I have that code: #include <stdio.h> #include <stdbool.h> #include <unistd.h> #include "esp_system.h" #include "esp_timer.h" #include "freertos/projdefs.h&...
Губин Егор's user avatar
-2 votes
0 answers
79 views

Here is the code: void (*volatile sys_func)(void); void main(int argc, char **argv) { int i, j; for (j = 0; j < 3; ++j) { for (i = 0; i < 10000; ++i); sys_func(); } ...
chav1s's user avatar
  • 37
1 vote
0 answers
57 views

I'm trying to use C source files that are located outside my Ceedling project root. My repository has shared code in a common/ folder at the repo root, but my Ceedling project is in boards/CANGateway/....
Stop It's user avatar
  • 11
Best practices
1 vote
12 replies
113 views

I've been researching this for a day and I've found a lot of conflicting information on multiple websites. I'm writing a simple test that will allocate and initialize a char** (array of strings, char*...
Maryann's user avatar
  • 39
1 vote
0 answers
108 views

This is a follow up to my previous question about creating a debugger for C source files in Python. The current issue I am facing is monitoring changes to variables. I want to monitor 8 variables say ...
user14773854's user avatar
-9 votes
0 answers
56 views

{"level":"error","ts":1764409482.772595,"caller":"vddk-service/service.go:125","msg":"Failed to open disk","error":"...
Atif Shafi's user avatar
  • 1,178
4 votes
3 answers
127 views

I've found that there are conditions that the second argument of va_start(ap, last) must satisfy, which are: last must not be a register variable last must not be a function last must not be an array ...
Doohyeon Won's user avatar
-3 votes
0 answers
72 views

How can I get autoindentation to use Whitesmith style for C/C++ files in VSCode? I use Microsoft C/C++ Extension pack and clang-format. "Format Document" works ok with C/C++ files.
tohoyn's user avatar
  • 161
2 votes
1 answer
122 views

I have 2 files: foo.c: #include <stdio.h> int Main(int a) { printf("A%dB",a); } int main() { return Main(1); } bar.c: extern int Main(int); int main() { return Main(2); } ...
Stas Badzi's user avatar
1 vote
0 answers
37 views

When I use the F2800137 DSP chip to develop a CPU timer code with ccs20.3 version, I find that the macro named __TMS320C28XX__ in cputimer.h file is not defined, which leads to me not being able to ...
fengyirusi's user avatar
-3 votes
4 answers
155 views

Okay, this isn't exactly a typical programming situation. I wanna make a pokemon-like homebrew game for the nintendo DS (I know I could use C++, but I only know C so I'm just trying to code in C for ...
Roland Carpenter's user avatar
5 votes
1 answer
96 views

My code is ... fragment1 // compares several regions in D1$ to D1$/D3$ __atomic_fetch_add(&lock,-1,__ATOMIC_ACQ_REL); // stmt A fragment2 // moves several regions from D1$/D3$ to D1$ ...
Henry Rich's user avatar
3 votes
2 answers
188 views

I duplicated the topic because (possibly) I made a mistake with the section of the site and initially posted in the wrong place: Ways to reliably read an object in C I have a regular byte buffer ...
Evgeny Ilyin's user avatar
Best practices
1 vote
5 replies
141 views

I have a regular byte buffer declared in file scope: static unsigned char buffer[32]; At some point, the function to start a DMA read operation into this buffer is called: void func(void) { ...
Evgeny Ilyin's user avatar
4 votes
1 answer
118 views

I have a more complex situation that uses pthreads, synchronized with condition variables. Each thread had its own condition variable so there is no access problem. The code runs a loop of 10 ...
tomdean1939's user avatar
4 votes
2 answers
133 views

For background, I am working to create a version of minesweeper that runs in the terminal to become more familiar with coding bigger projects in c. I am coding in VScode, to run on a Linux server (...
Librarian of Stars's user avatar
2 votes
0 answers
73 views

Alright, so bear with me. This took me an entire day to dig into. what I'm doing I'm running a C program on a remote host over SSH. The program calls a local redis database IP and port and also 8.8.8....
NorseGaud's user avatar
  • 801
3 votes
1 answer
195 views

I have the following C code that I am testing to understand perf and caching. It sequentially accesses an array of doubles. // test.c #include <stdio.h> #include <stdlib.h> #include <...
user180574's user avatar
  • 6,244
2 votes
0 answers
95 views
+100

I have multiple UIO interrupts defined. I am using Linux 6.12 without the realtime config (so, using the default scheduler, CFS). My userspace driver is using poll in a loop to watch these interrupts ...
Woodrow Barlow's user avatar
3 votes
2 answers
83 views

So, for context, I have started writing a small HTTP-Server for learning purposes. Currently, I have 2 modules: server and logger. The server module uses the logger I wrote internally for logging ...
Puscas Raul's user avatar
-1 votes
0 answers
67 views

I'm following the barebones guide on OSDev Wiki and I'm trying to compile my kernel.c file with i686-elf-gcc -ffreestanding -O2 -m32 -c kernel.c -o kernel.o but I constantly get the following ...
James Cho's user avatar
1 vote
1 answer
121 views

I am writing a C application, to be distributed as a single static binary (so it doesn't have a chance to do anything like install message catalog files). It only needs to support a few natural ...
interfect's user avatar
  • 2,987
3 votes
2 answers
108 views

I have an application where I need to generate date and time based on the locale using the strftime function provided by C's time.h: #include <stdio.h> #include <time.h> #include <...
Micro Soft's user avatar
Best practices
0 votes
5 replies
84 views

Let's take a silly example: #define MAX_NUM_BITES 20 ... void live_another_day() { ... int num_bites = 0; ... eat_little_pig(&num_bites); if (num_bites>MAX_NUM_BITES) { printf(&...
Lolo's user avatar
  • 4,219
9 votes
1 answer
423 views

How can I get notified when the user minimizes or restores my X11 window? On very old Linux versions I could check for the UnmapNotify message to learn when the window is minimized and MapNotify when ...
Andreas's user avatar
  • 10.5k
2 votes
1 answer
54 views

I have two ESP32S, each connected to a CAN driver (MCP2515 + TJA1050). One is constantly sending data, the other is constantly only receiving it. I want whoever receives the data to work in Listen-...
Губин Егор's user avatar
Tooling
1 vote
9 replies
136 views

I have inherited a project with over 8000 C source files from 26 years ago, so they have all kinds of old cruft that modern compilers (and best practices) won't put up with (old-style function ...
John Hascall's user avatar
  • 9,444
-3 votes
0 answers
58 views

I am working on a PIC16F877A project in Proteus (bus stop detector using HC-SR04 + LCD). The code is written in mikroC. When I run the simulation, the LCD only displays “Systeme Pret…” and then ...
samar's user avatar
  • 1
2 votes
1 answer
92 views

I'm asking this question from the perspective of a compiler developer – I want to know whether a particular potential optimisation is valid (because all programs that the optimisation would break have ...
ais523's user avatar
  • 2,384
0 votes
0 answers
37 views

I tried using the GTK inspector to try and find the correct css node for but to no avail I tried every selector i could think of like .GtkSourceView.sourceview.view text .current-line or even ...
fabinho's user avatar
  • 31
0 votes
1 answer
100 views

I am learning on how threads can be cancelled. Asynchronous cancellation can cancel the thread at any given point in time, but what I have learned about deferred cancellation is that it can only be ...
Easha's user avatar
  • 9
2 votes
1 answer
113 views

In the C standard (at least, I'm looking at draft C23 WG14/N3088), section 6.7.3 Type Qualifiers states: 7 If an attempt is made to modify an object defined with a const-qualified type through the ...
Evgeny Ilyin's user avatar
1 vote
2 answers
130 views

#include <stdio.h> void update_score(int temp_score) { printf("Inside Function: temp_score starts at %d\n", temp_score); temp_score = 50; printf("Inside ...
J Chan's user avatar
  • 13
2 votes
2 answers
164 views

I have this code in C11 (skipping references to pre-declared variables and functions): // [...] char *old_buf = it->buf; shift += it->buf_size; it->buf_size *= ...
user3758232's user avatar
Advice
0 votes
4 replies
191 views

Title: Why does GCC transform a >= 4 into a > 3 at -O0? JG seems more complex than JGE I'm analyzing a simple C code on godbolt and found GCC's code generation puzzling: long a; a = a >= 4; ...
Alexandr's user avatar
-2 votes
1 answer
197 views

So I have the following code: float param1 = SOME_VALUE; switch (State) { case A: { foo(param1); statement1; break; } case B: { bar(); ...
Kai Yin's user avatar
Advice
1 vote
5 replies
79 views

I created test project - "TaoTester" and test package with C-library called "SwiftGit2". After few days of work in package almost all works fine.... EXCEPT: I cannot link C-...
Andrew's user avatar
  • 11.9k
-3 votes
0 answers
85 views

here's the question and my answer,and i hope somebody to help me check my answer.i thought my thought procees was right,but something wrong happened this my answer payload = "" payload += '...
Chi Cui's user avatar
5 votes
1 answer
206 views

In C, if I call a static function from an inline function, I typically get a compiler warning like warning: static function <name> is used in an inline function with external linkage [-Wstatic-...
Rasmus's user avatar
  • 433
Best practices
1 vote
3 replies
119 views

I know that the current options are: creating a thread, a fork or a non-blocking socket? What are the main advantages and disadvantages of all options? What would be the recommendation for a small ...
Puscas Raul's user avatar
2 votes
3 answers
203 views

C23 §5.2.5.3.3 [Characteristics of floating types <float.h>] paragraph 8 says: Floating types shall be able to represent signed zeros or an unsigned zero and all normalized floating-point ...
Jan Schultke's user avatar
  • 43.7k
Advice
0 votes
1 replies
42 views

Disclaimer: I'm expecting that the answer to this question will be that it can't be done, but I'm asking as a just in case. I am working on a JIT'd language with the compiler and runtime implemented ...
idka's user avatar
  • 131
Tooling
0 votes
3 replies
98 views

Which IDE and tools are best suited for gcc C development? I currently use vscode and the tried using the ms-vscode.cpptools extension which "supports" gcc C. But extensions like nested ...
mcmah309's user avatar
Best practices
2 votes
1 replies
49 views

I have a C application that uses pam to reauthenticate a user on a system with faillocks configured. Imagine something that would work similar to login on the outside. However, it only does basic ...
Ágatha Isabelle's user avatar
3 votes
1 answer
102 views

I'm participating in an online Sudoku-solving challenge where you create an account, and the server gives you a JWT token. Every request (getting the board, submitting answers, etc.) must include that ...
Novice's user avatar
  • 55
3 votes
2 answers
130 views

I recently started learning C and as a learning project I tried creating a tic tac toe bot using the Minimax algorithm. Here is the code that I have written so far: #include <stdbool.h> #include ...
floatingCatsAndDogs's user avatar

1
2 3 4 5
8167