408,104 questions
Score of -1
0 answers
108 views
How to check if my program was run with sudo?
I am writing a basic CLI tool for my first major project. It'll need to r/w to a config directory in the user's home as well as r/w to SQLite DBs. To avoid permission issues, I want to allow ...
Score of 2
1 answer
88 views
Is there any way to make Microsoft's swprintf implementation standards-conforming?
Microsoft's implementation of swprintf from MSVC is non-standard. In particular, the ISO C standard requires that swprintf use %s to correspond to a char* argument and requires using %ls to ...
Score of 2
0 answers
119 views
How do I use a C library when building with trunk-rs?
How can I integrate a C library, that uses libc, when compiling a web application to WASM with trunk?
I'm trying in particular to use this fork of cubiomes in my application that I'm building with ...
Score of 2
2 answers
197 views
How should I partition a memory region returned by mmap() into allocator blocks?
I'm experimenting with writing a simple memory allocator in C. I use mmap() once to reserve a 10 MiB region and want to manage allocations inside that region myself.
#include <stddef.h>
#include ...
Score of 1
1 answer
187 views
C language error with passing a 2D array as an argument to function
I have a question about my code :
#include <stdio.h>
void draw_a_square(int row,int column, int grid[10][10]){
for(int r = 0; r < row; r++){
for(int c = 0; c < column; c++){
...
Score of 5
2 answers
230 views
Why no "provisional" declarations of static objects?
[Full disclosure: This question is a follow-on to a related question I asked yesterday. Like that question, I'm tagging this one both C and C++, because it appears that C and C++ may be slightly ...
Score of 2
1 answer
215 views
Mutually referential arrays of structures
(I'm tagging this question both C and C++, because I'm asking
about what seems to be a surprising difference between C and C++.)
Suppose I have two structures, a and b, which reference each
other, ...
Score of 4
2 answers
157 views
How to use X as type name in Template(X) in c
I want to use macro to define a Template(X) in c.
The X in "min(X, Y)" is used to compare two values, but the X in "Template(X)" is just a type and it will never be used.
But the ...
Score of 0
2 answers
135 views
Why does my function (involving GTask and async operation) hang when called from gtk_widget_queue_draw()?
With some kind help from Mohammed here on Stack Overflow, I have implemented a GTask to handle async Javascript execution: How do I wait correctly for web_view_javascript_finished() to return in gtk4 ...
Score of 0
1 answer
118 views
result of sizeof expected expression on array declaration [closed]
In drone.h,
I have a struct
typedef struct {
char name[MAX_DRONE_NAME_LENGTH];
enum drone_model model;
uint8_t status_bitarr;
} drone;
and a define
#define DRONE_STATUS_LENGTH (8*sizeof( ((...
Score of 3
1 answer
162 views
How to make two structs to share the same data in C
I am developing the push swap problem, where I need to work with two stacks.
One of the tasks my program needs to do is to keep track of the number of operations of each type, there are 11 of them ...
Score of 2
1 answer
87 views
MSYS2 GCC doesn't compile when it's not at the top of PATH
I'm using MSYS2 with UCRT64.
When "C:\msys64\ucrt64\bin" is below "C:\Program Files\Meld" in system PATH, gcc doesn't compile, but shows no error.
Meld folder has a few .dll files ...
Advice
0
votes
4
replies
171
views
Embedded systems interview
I've been working as an Embedded Systems/Firmware Engineer for about 2 years. While I have hands-on industry experience, I still find embedded technical interviews quite challenging.
One thing I've ...
Score of 4
0 answers
127 views
Is the acquire load on top necessary in this C11 Chase-Lev Deque implementation?
I am analyzing the C11 adaptation of the Chase-Lev work-stealing deque from the paper "Correct and Efficient Work-Stealing for Weak Memory Models."
The paper says their C11 implementation is ...
Score of 0
0 answers
99 views
NATS.IO code on github seems not to support Windows any longer, but does it? [closed]
Is there any longer C support for NATS in Windows (Visual Studio) for client or server? Seems only to support linux now. If I could find binaries (nats.dll, nats.lib, nats-server.exe) in 64 bit, that ...