On Sun, May 26, 2013 at 01:18:32PM +0200, Paulo Pinto wrote: [...] > Did you had the pleasure to write portable C or C++ code across > multiple operating systems and vendors in the mid 90's? > > Welcome to #ifdef spaghetti code and reluctance of using certain > features due to inconsistent support. [...]
Ugh! Don't remind me. Right now at work I have a project that requires reading (yes, just reading) some heavily #ifdef'd code. It's a very, very, very painful experience. Not to mention function pointer spaghetti. One of the symptoms of switching from C++ back to C is that there's no polymorphic abstraction anymore, so the only way to have a sane polymorphic system is to use tables of function pointers everywhere. When a bug happens in some obscure corner of the code, it's hours and hours of hair-pulling to discover just which of 50 different function pointer initializations were in effect when the bug happened, for each of the 50 function pointers traversed before the buggy code. It's gotten to the point that every other line of code is a call through a function pointer, each of which has its own set of 50 or so different functions that it can potentially point to. It doesn't help that many of these function pointers are unhelpfully named. I'm quite near the point of losing my sanity just trying to figure out the control flow of the thing! Ah, if only this code were written in D... :-P T -- What doesn't kill me makes me stranger.
