Questions tagged [c]
C is a general-purpose computer programming language used for operating systems, games and other high performance work.
1,331 questions
2 votes
4 answers
140 views
Multithreaded Game Server: Single send() or Many send()s for Game List?
I'm developing a multithreaded game server (C/TCP). I need to send a list of 50-100 available games to a console client. Option A: Send 50-100 separate messages, using send() for every single ...
1 vote
2 answers
166 views
Where to initialize clients in C server?
I’m writing a multiplayer server in C using sockets and pthreads. The project is separated by responsibility: server.c/.h → networking (socket, bind, listen, accept, thread creation) player.c/.h → ...
4 votes
6 answers
857 views
Can a language be sound if it doesn't promise safety?
It is said that C's type system is unsound, which means that it has "false negatives", it tells the programmer everything is fine, but then the code fails at runtime. for example, "the ...
1 vote
3 answers
688 views
Should I include the header of the source file always in C/C++?
I have a source file that is used by other sources so it has a header file. If in the header, there are types used that needs inclusion of other headers, I'm better to include this header in its ...
1 vote
3 answers
373 views
Is Feeding a Watchdog Timer from an Interrupt Service Routine a Bad Practice?
In an embedded system, I require a watchdog to be able to pass ESD qualifications. Having no experience with watchdogs, I went through this Memfault article. I liked the events "registration"...
6 votes
4 answers
726 views
Why is there (practically) no 6-byte integer in common usage?
In Postgres, it used to be quite common to use a 4-byte integer auto field for primary keys, until it started becomming somewhat common to run into the 2147483647 limit of 4-byte integers. Now, it's ...
0 votes
2 answers
302 views
What should I consider when determining what `ALLOC_MAX` should be in this type of I/O loop?
For, e.g. determining an amount of memory that is safe to allocate for processing file or device with this type of I/O loop: HANDLE hFile /* = file open with GENERIC_READ */; LARGE_INTEGER liSize; ...
7 votes
2 answers
726 views
When the stack frames become computationally expensive
I've been experimenting with different data structures and algorithms in Python, Java and C to see in what circumstances function/method inlining could bring meaningful gains in terms of the execution ...