March 1, 2009
A nice little quickie: I briefly discuss in my assert ramblings why it’s important to wrap all of your multi-line macros in do/while(0) blocks. An unfortunate side-effect of this is that the construction
// NOISY CODE
#define MULTI_LINE_MACRO \
do { \
std::printf("Hello "); \
std::printf("world!\n"); \
} while (0)
will trigger C4127: “Conditional expression is constant” in Visual Studio 2003/2005, and probably 2008 as well (but I haven’t tried it). The culprit is the “while(0)” part, the compiler thinks we’re making a mistake when of course this is all very intentional. Let’s see what we can do to fix it!
(more…)
February 15, 2009
OK, before we begin, I want to make sure we’re all iPhone-toting hipsters here. We love the visual voicemail, and all the lifestyle-enabling apps like Facebook, Shazam, Amazon.com, and the AP News Wire. The games are great, too.
Texting, however, leaves a little to be desired. The conversations are threaded, which is all well and good, but there’s no MMS anywhere to be found. There aren’t even emoticons anywhere either, so we all send ASCII smileys back and forth: “:)” “:(” “;-)” “:-D” “X-[” and so on.
Japan leapfrogged us on this one. Evidently most Japanese cell phones come with Emoji, which is a reserved set of the Unicode character space exclusively for emoticons!
(more…)
Filed under:
iphone by charles
February 10, 2009
This is a re-hosting of the original Assert article I wrote in April 2007, during the epic rise and fall of Power of Two Games. I’m reprinting it here on my personal site now that Pow2 is defunct and expired. Of the few reasons we failed, the lack of a good assert macro was not one of them!
(more…)