19 questions from the last 7 days
-1
votes
0
answers
13
views
Which programming language or topic should I study now (2026) or should i study other topics? [closed]
I’m currently unsure which programming language or computer science topic I should focus on. There are many options, and I don’t know where to begin. Any guidance or recommended learning paths would ...
1
vote
1
answer
78
views
Do compatible types have the same representation?
Furthermore, is the sizeof guaranteed to be the same on compatible types?
I expect the answer to both of these questions is likely "yes" in practice, but I don't see anything in the standard ...
2
votes
2
answers
118
views
C promotions confusion: signed/unsigned vs Windows/Linux
I found this code on GitHub and realized the hard way that it works on Windows, but not on Linux
#define HASH_CONSTANT 2654435769
uint32_t fibHash(uint32_t hash, uint32_t shift) {
return (hash * ...
0
votes
0
answers
94
views
File IO in C++ (or C) without the overhead of copying between two buffers with Linux Systems [closed]
I'm interested to understand more about performing file IO operations with systems programming languages in a way which does not use both a kernel space buffer and a user space buffer.
Specifically I ...
7
votes
2
answers
107
views
How can I flock LOCK_EX if there is always a LOCK_SH?
I have a multi-threaded application.
One of the threads is a background maintenance thread, which needs exclusive access to some of the files. The rest of the time, the file can be (and is) read by ...
-3
votes
0
answers
89
views
How does TLS 1.3 derive a shared secret? [closed]
I am writing a bare minimum HTTPS/TLS 1.3 server in C. Currently I want it to work an just the bare minimum spec:
X22519 key establishment
AES 128 GCM encryption
Self signed certificate
I find ...
3
votes
2
answers
164
views
C Struct Passed By Value Memory Addresses in Called Function
I've seem to run into something I can't really explain. I'm testing out passing a struct (typedef with an alias) by value into a function and printing out the addresses of each. I do realize that ...
Advice
2
votes
7
replies
119
views
Compund literals as struct initializers
Let's consider this example code:
#include <stdint.h>
#include <stdio.h>
struct image {
int width, height;
uint8_t *pixmap;
};
static void iprint(const struct image *img)
{
...
12
votes
4
answers
1k
views
Why don't C overflow checks use CPU flags?
Both amd64 and arm64 architecture processors have an overflow flag. However, in C, the most common method to detect whether an operation causes overflow/underflow is to make functions like these:
int ...
Advice
0
votes
5
replies
128
views
Understanding a Component of a C Function Declaration
I am reviewing an application and it has numerous functions with the following function declaration. I've never seen this type of function declaration with the "local" identifier before the ...
0
votes
1
answer
132
views
Finding an Integer value in A binary file in C [closed]
In C, I first opened a binary file like this---
FILE *BINfile = fopen("./tmp.bin", "rb+");
Then I transferred the data into an unsigned char array (typedef as byte) like this---
(...
3
votes
2
answers
111
views
Question about retry logic in usb-skeleton.c skel_read()
I'm a computer science undergraduate student studying Linux kernel USB device drivers.
While analyzing the skel_read() function in usb-skeleton.c, I noticed what seems like inconsistent retry logic. I'...
1
vote
1
answer
70
views
Failure to enumerate USB device with DWC2 USB host
I am working on an embedded RTOS system for a 32-bit MIPS SOC, which supports DWC2 OTG. (It can run Linux well.)
I ported an open-source USB stack to this system by following the porting guidance.
...
3
votes
2
answers
179
views
Getting inflated results when trying to find newline '\n' in a char array in C
First I opened a .txt file (less than 1kb btw) and stored the string data in a char array like this---
FILE *file = fopen("./tmp.txt","r+");
char CharArray[10000];
fread(CharArray,...
1
vote
1
answer
97
views
How to use SQLBindParameter with a string that is not zero terminated
When I bind a BSTR to a column in an Access database (.mdb) and insert data into this column, I keep getting error #22001 which means the data has been truncated. The source of the data is shorter ...