C is a general-purpose computer programming language used for operating systems, games and other high performance work.

learn more… | top users | synonyms

1
vote
1answer
45 views

Using GPLed headers in LGPLed library

For a specific device there exists a Linux kernel module. This module only initialized the device and provides control mechanisms to user land via ioctls and mmap. To use this the device properly one ...
-2
votes
1answer
607 views

Bresenham Vs Midpoint Circle drawing algorithm

Can somebody explain the difference between Bresenham and Midpoint Circle drawing algorithms? All I am able to understand is that in both algorithms we compute coordinates of an octant instead of ...
3
votes
0answers
365 views

Fast fixed-size (256 bit) integer modulo/division

What is the fastest way to divide two 256-bit integers? They are represented as an array of 26-bit words, each stored in 32-bit integers. I have access to a 64-bit type if that's useful. It seems ...
2
votes
0answers
65 views

What are the benefits of an input/output component design?

For the company I work at, all of our projects, including a new one started last year, are written in C89. We write for vxWorks (a real time embedded operation system). Our software runs ...
2
votes
0answers
202 views

Have any C compilers ever *defined* `unsigned short x=-3; x*=x;` to yield anything other than 9

In a C implementation where int can hold all values of type unsigned short, standard integer promotion rules dictate that given the code: unsigned short x=(USHORT_MAX+1)-3; // Or just -3 x*=x; a ...
2
votes
0answers
617 views

using flat file vs sqlite db for frequent data grabbing in a cron job

I have some automated task to be done using certain types of logs generated on the server end of each day. Log files contains specific machine identification "MAC" that is to be re-written in to ...
1
vote
0answers
87 views

Unit testing C code?

I learnt about the check testing framework today that seems good. This far I've scripted tests that uses valgrind so that the tests both display output from the tests and from valgrind. Is there a ...
1
vote
0answers
91 views

How to use an enumeration type, when the values are not known at first?

We have a project, that consists of a cluster of C source code, a C library and a C++ library. The C++ library is dependent only upon the C library, or at least that is what I am trying to achieve. ...
1
vote
0answers
318 views

In-place merging of sorted intervals in an array?

So I have code producing k sorted intervals in an n-sized array. What I'm brainstorming is the possibility of in-place merge of these intervals into a single sorted interval/array. The problem is ...
1
vote
0answers
393 views

How does a dynamic library's references to a static variable get translated once in the running app?

If a dynamic library exports the address to a global variable defined within the library, how are accesses to that variable translated during dynamic linking so that a running application can interact ...
0
votes
0answers
63 views

Please let me know more refactoring strategies for my codebase?

I have written a shell command-line interpreter which uses loops and recursion (but maybe not "recursive decent", that usually solves this problem) I want to refactor the function to 4 or 5 smaller ...
0
votes
0answers
37 views

Best way to update driver data from userspace

I have a userspace application which interacts with a kernel-space driver in a Linux environment. The driver, in this case, is an LED driver. In typical *nix fashion, the driver exposes a file in ...
0
votes
0answers
69 views

A callback for when data is received?

So, my understanding is that the Kernel could receive TCP at any time, and that generally a C program asks the Kernel synchronously/asynchronously if it has data available. Would it be possible for a ...
0
votes
0answers
47 views

Synchronizing content between web-based app and game server

I have a MUD server, written in C, that I'm trying to move from file-based storage to MongoDB. Eventually, I'd like to offload administration of game content and settings to a web console, written in ...
0
votes
0answers
114 views

GMP Core Dump while using mpz_clear in C

I'm working on a prime factorization program written in C using the GMP library through cygwin. The algorithm that I have now works fine, but has memory leaks from not using the mpz_clear function on ...
0
votes
0answers
535 views

Best way to signal all child processes to terminate using C

I have been assigned the task of designing a simple web server using C in my UNIX & C class. The webserver listens and forks when a successful connection is made so that multiple clients may be ...
0
votes
0answers
94 views

Abstract Web API from validation and configuration management in embedded system

Im working with embedded Linux for a router. There is a web GUI for the user to configure router options. When user fill a web form this is submitted to a web server function that is responsible of ...
0
votes
0answers
300 views

Writing Z80 table based assembler/disassembler

I have a long-term project: DIY computer with various processors. One of my wishes not only make hardware, but software too. So I started from assembler/disassembler for Linux, though there is a lot ...
0
votes
0answers
90 views

Does multiple Bloom filters make sense?

In order to decrease the number of false positives, I came up with a couple of possible solutions. Create two different types of Bloom filters; eg. filter1 using 3 different hash algorithms, filter2 ...