Eric Day

Thoughts, code, and other oddments.

c

cache_line.c - Test the cost of multiple threads addressing memory on the same cache line.
const.c - Examples of the various ways to use const.
define_vs_inline.c - Check the difference in speed between #define and static inline.
fast_time.c - Check the difference in speed between gettimeofday and clock_gettime.
memset_vs_list.c - Check the difference in speed between memset and list initializing.
micro_bench.c - Compare C vs C++ in a micro benchmark.
partial_init.c - Partial struct initialization.
stack_heap_alloc.c - Check the difference in speed between stack and heap allocations.
state_stack.c - An example state machine using a function stack.
thread_notify.c - Test the difference between conditional and pipe thread notification mechanism.
uuid_dupes.c - Test the if uuid_generate_time() can produce duplicate values with threads.

c++

autoptr.cc - An example showing how to use auto_ptr.
bad_factory.cc - How NOT to create and use class factories.
const.cc - Examples of the various ways to use const. See const.c as well.
enum_and_const.cc - Prefer enum and const over #define. Also use enum for static values.
exception_cost.cc - Micro-benchmark comparing the cost of exceptions vs return code checking.
inline_template.cc - Prefer inline template functions to #define macros.
member_ptr.cc - How to use pointers to public class members and methods.
micro_bench.cc - Compare C vs C++ in a micro benchmark.
no_copy.cc - How to make classes un-copyable.
state_stack.cc - An example state machine using a method stack.

python

bitfield.py - Base class for managing bitfields.
rate_limit.py - Class to rate limit a resource.

Thoughts
Code
About
RSS

Trap.it
Scale Stack
NW Veg
Veg Food & Fit