Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
3 votes
2 answers
78 views

Simplify 2D point angle comparator

I have a comparison function for comparing two points in 2 (or more) dimensions based on the angle of each point in standard polar coordinates. In other words, a point ...
hacatu's user avatar
  • 462
6 votes
2 answers
656 views

Error Code Stack Trace and Propagation Library in C

I've been programming in Go and I enjoy how easy it is to create descriptive errors and propagate them up the call stack. I wanted that sort of ease and consistency in C so I created a small error ...
Ollie's user avatar
  • 163
2 votes
1 answer
445 views

Supplying parameterless callback to function expecting void * param

I have to register different callback functions to a scheduler. The callback signature defines a void * parameter. Some callbacks don't use a parameter. This works, ...
robsn's user avatar
  • 121
4 votes
1 answer
2k views

Stateful function pointer for passing C++ capturing lambdas / std::functions to C style callbacks

...
demiralp's user avatar
  • 133
3 votes
1 answer
2k views

Callback C++ Class method from C

I am trying to callback C++ class methods from C. Now I have got something working, but am not sure if this is the best solution. I am looking for feedback, as to if there is something wrong with this ...
mmcblk1's user avatar
  • 33
5 votes
1 answer
101 views

Function to foreach over an array

I made a very simple generic function to foreach over an array in C using a callback function: ...
PointerToConstantChar's user avatar
11 votes
1 answer
2k views

Callback in Linux kernel driver in order to hide device's low-level protocol

I'm am writing a Linux kernel driver for HD44780 LCDs connected via I2C bus. In my last change I tried to decouple low-level code (which talks to the device via I2C) from device's logic (printing ...
m.g.'s user avatar
  • 111
3 votes
1 answer
3k views

Basic socket library in C

I am trying to learn C and have written a very basic socket library. I would be interested in any general design and coding comments. Note that at this stage I am not bothered about implementing the ...
arcomber's user avatar
  • 2,439