Skip to content

{ Category Archives } C/C++

When Ants Come to Your Picnic

Since I posted my “Sling Blade Runner” answer, I’ve been in discussion with Benjamin Meyer about the puzzle, my solution, and other general topics. During this discussion, he shared his solution with me, and as a collaboration, we found a set of movie titles that is 326 movies long. The original list of [...]

Sling Blade Runner

Lately, I’ve been without a project to keep me busy at nights (hence all my blog posts). I’m learning python, but since my main gig is C/C++, I like to keep those skills sharp with little puzzles. While looking for interesting coding puzzles, I stumbled across a page at ITA Software that asks [...]

Safe Mutex Management

Recently, I’ve been writing a fair amount of threaded C++ POSIX code, and (as I often do), I decided to wrap the POSIX mutexes in a convenient little wrapper class:
 
class Mutex
{
pthread_mutex_t mMutex;
public:
Mutex() { pthread_mutex_init(&mMutex, NULL); }
~Mutex() { pthread_mutex_destroy(&mMutex); }
 
void [...]

Escaping the MTRX

Embedded developers have it harder than most. Often we don’t have library options most other developers do. For example, the library might depend on file I/O, or it might require easy access to a large heap, or it even might require floating point arithmetic that our part is no good at implementing in [...]

A line in the sand

The other day, someone (who shall remain nameless to protect their identity) asked me the following:

I have a set of data points, (X,Y), and I know they are related through a simple function:

How do I determine m, and b?

Now, there are many ways to determine values for m and b; but, right now I’d like [...]

Tricky Trig

Recently, I needed to generate sine and cosine values at a rapid rate. I couldn’t use C’s sin and cos functions as they took too much processing power. Additionally, since I needed phase angle resolution of 16 bits precision, a lookup table would have required 2^16=65,536 word sized entries — an impossible requirement [...]

A Misunderstood Beast

I don’t want my blog to become a C++ lovefest, but I just seem to keep running into possible topics within the language to post about.
Recently, I ran across an article on embedded.com by Alan Anderson. I love everything he says in the article, save one paragraph:

Given the drawbacks to all of these approaches, [...]

The Ties That Divide

Recently, I have been working on a project with the Make Controller. The Make Controller has been a handy platform for me to explore the ARM architecture, and the libraries distributed by MakingThings make it easy. While screwing around with the build of FreeRTOS included with the software, I stumbled across a piece [...]

DebugStream (low overhead C++ printf debugging)

Although I currently don’t use it much, I fancy myself a bit of a C++ programmer. Over the years, I’ve accumulated a number of neat C++ coding tricks. For example, while in graduate school, I met Jeff Squyres who taught me a neat little C++ technique that I have used often since then. [...]