Gautam Iyer a écrit : > I somehow prefer #ifdef'ed mandatory dependencies. But if it makes the > code really ugly, then don't worry about it! > > GI >
For me it is not about ugly code or not, but about readibility and understanding of the code. When I see a #ifdef condition, then it seems to me, there is some alternative (which is usually really what it means!). Hence I am thinking "but if this happens to be wrong... what should I do as another solution?". Then for a single problem, you have to think twice (or more!) as much. Moreover it is especially very difficult to test, because you have to compile it several times (as this is not a runtime, but a compile time test), but also because usually you use the software yourself one way only. So usually you may make very basic tests in the alternate way (and sometimes none!), but you will only make deep tests on your main favorite way. So you create potentially very buggy branches of your software without even knowing it. This is of course OK if there are other developpers using the other way as their own favorite one, so they can test for you when you change something. But if everyone prefer the same way... then why keep the other?! This is why, if I can avoid #ifdef, I really prefer to. And if this is about mandatory dependency, I don't see any reason why you would mess the code with #ifdef. Anyway if the user hasn't the right dependency, you would not want him to be able to compile a non-working code successfully (if he somehow manage to pass the configure step, for instance if the configure script has itself a bug), but then crashing at runtime (and the guy would think that mrxvt is completely buggy). Jehan ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Materm-devel mailing list Materm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/materm-devel mrxvt home page: http://materm.sourceforge.net