Skip to main content

Questions tagged [c]

C is a general-purpose computer programming language used for operating systems, games, and other high performance work and is clearly distinct from C++. It was developed in 1972 by Dennis Ritchie for use with the Unix operating system.

Filter by
Sorted by
Tagged with
2 votes
0 answers
7 views

Markdown parser library in C

For a side project, I needed a markdown parser and I decided to roll my own. It is a SAX-style parser, i.o.w. you can hook into parser events on consumer side and do whatever you want with the content....
Quanta's user avatar
  • 121
6 votes
1 answer
80 views

Shared-Memory Queue Implementation in C

Recently I am working on implementing a shared-memory based IPC message queue in C programming language on Linux system. A few design choices I've made include The queue will have only 1 producer, ...
Yukun Jiang's user avatar
11 votes
3 answers
1k views

Parsing HTTP headers in C

I'm new to C and just finished K&R. This is a code that I've written to parse headers of a HTTP request. I want to know if my code: Is safe? (after all this is C) Does proper exit on failure? Are ...
Mehan Alavi's user avatar
10 votes
6 answers
2k views

k-Nearest Neighbors algorithm in C

I've been learning C for a while, and I decided to make a simple kNN program. What can I do to improve the program? Am I doing memory management right? Can the structure of the code be improved in ...
Super Tux's user avatar
  • 103
3 votes
0 answers
40 views

library variant during application startup

I wrote some PoC for load library with best optimization version during application startup. The goal for it check in the _init function code checking by cpuid ...
Jakub Juszczakiewicz's user avatar
7 votes
4 answers
1k views

Rot13 encryption with extra functionality using unix flags

I just wanted to check out options/unix flags and read from stdio through pipe. Is it any good? Where should I improve or use something else? Feedback would be much appreciated. ...
Husto's user avatar
  • 73
7 votes
7 answers
2k views

LinkedList data structure in C

Is my logic good? Are variable names fitting? Are there any memory leaks? Am I doing anything dangerous (this is C after all)? Please feel free to criticize the code. I want to know if I'm writing C ...
buzzbuzz20xx's user avatar
9 votes
5 answers
2k views

C method to determine whether a byte array is homogeneous

I engineered myself into a situation where I wanted to check whether a region of memory consists of identical bytes. I wanted to at least try to avoid the obvious solution of an O(n) loop, but also ...
Wasabi Thumbs's user avatar
2 votes
1 answer
172 views

Attempt at a Different Variation of the strstr(...) Function

I decided to work on an idea I had to 'optimize' the classic C function strstr. Most of the implementations I had seen that did not make use of advanced ...
mindoverflow's user avatar
5 votes
4 answers
627 views

Single Consumer Single Producer Wait-Free Zero-Copy Circular Message Queue

The title describes pretty well what the algorithm is for. It will be used for a realtime inter-process communication library that only uses shared memory for exchanging data. For realtime systems, it'...
mausys's user avatar
  • 117
4 votes
0 answers
73 views

16x16 integer matrix transpose using SSE2 intrinsics in C

I was inspired by this and this to make a C function that would take an array of 16 __m128i, treat it as a matrix of 16x16 ...
Steve Ward's user avatar
2 votes
0 answers
87 views

compile time, but Not inlined function in C and C++

We have a graphics library for the Ti84CE, which uses the 24bit eZ80. It has a 16bit 1555 screen, so we have a gfx_Darken function that will darken a 16bit 1555 ...
Vortex 2728182818's user avatar
7 votes
2 answers
979 views

Desperately seeking a hashing function

A recent CR exchange led me to dust off and adapt some code I'd written a few years ago. Long, long ago, when core meant ferro-magnetic memory cells, I spent an hour formulating a "simple" ...
Fe2O3's user avatar
  • 1
5 votes
3 answers
1k views

Arcane algorithm to find a keyword in a lookup table

This code is supposed to efficiently return the index+1 of a matching keyword from a lookup table of up to 31 keywords ...or 0 if the keyword is not found. The line ...
George Robinson's user avatar
4 votes
1 answer
500 views

Find a keyword in a lookup table

This code is supposed to efficiently return the index of a matching keyword from a lookup table or 0xF if the keyword is not found. The line is a zero-terminated ...
George Robinson's user avatar

15 30 50 per page
1
2 3 4 5
273