Category Archives: C/C++

This Category covers language concepts to the C and C++ languages

C++ Coding Standard: The If Block

Almost two months ago I went to a CocoaHeads meeting during Macworld. They had Mike Lee talk. His presentation was about “Pimping Your App”. There were a bunch of interesting points, but one thing really stuck in my head. Mike was talking about how is a messy person in his life. His car is messy. [...]

Posted in C/C++ | Leave a comment

Stupid std::vector Class

The Standard Template Library in C++ is nice to provide us with a bunch of different container classes so we don’t have to re-invent the wheel every time we write new code. One of the classes is called “Vector”, if you aren’t familiar with it, you might not get too much out of this post. [...]

Posted in C/C++ | Leave a comment

Leap Year Spells Trouble for Zune Users

On December 31st, all 30GB Zune users woke up to their music players not working. In a rarity for Microsoft problems, the source for for the problem was found. There is a good explanation of the problem here. There are two lessons to be learned from this: 1) be careful of your looping conditions. 2) [...]

Posted in C/C++ | Leave a comment

The Address of Monkey

Have you seen the following C code sample: char x = 1; char c = x["monkey"]; Do you know what it the value of c is? Don’t read on unless you want to know the answer and why. The value of c is ‘o’. Why? Well, I wrote some code to start playing around with [...]

Posted in C/C++ | Leave a comment

Why 2 can sometimes equal 1

Ran into a fun situation today where I was writing some code, and I came across an interesting situation in C++. Now, before I get to the end of this post, I’ll give you the punch-line, Developer stupidity. So I was working on a exercise where I needed to write some sort of state machine. [...]

Also posted in Programming | Leave a comment

Nuances in C: Struct Assignment in C

When I started this post, it was going to be a revolutionary post, talking about something that was really bothering me. As I have spent more time thinking about this, the answer seems so simple and obvious, still there was a time where I did not get this concept, so I here is a brief [...]

Also posted in Programming | Tagged , , | 1 Comment

Nuances in C: Array of Function pointers

I was in a job interview the other day and someone asked me the following question, which I got wrong. Its not hard to remember, but I figure if I pass it on, and anyone out there who reads this blog for technical content might get a little refresher.The question was something like: write the [...]

Also posted in Programming | Leave a comment