Rick Parrish wrote: > Link to the document in question ... > > http://www.mozilla.org/hacking/portable-cpp.html > > Here's the link to the person's comments on slashdot ... > > >http://slashdot.org/comments.pl?sid=23789&threshold=0&commentsort=0&mode=thread&pid=2569881#2570009 > > > > What are people's opinions on this? Is this document out of date > as the above comments suggest? > > -rick >
Many of the points in that document are simply timeless common sense. Some are the result of very painful lessons. Mozilla code still has to compile on compilers older than the origin date of that document (note that the document cited has seen various updates since 1998). Having a language standard does not make compilers automagically comply - even newish compilers. For instance, there are a number of standards problems with even the most mainstream of PC compilers. Mozilla does allow for using templates where the cost/benefit is deemed to justify their use. But this requires the code author to do *significant* work to write code that works with all the compilers that matter. As Scott Collins can testify, this is a big undertaking - much bigger than one might think at first. There are a lot of potential pitfalls that no small subset of the supported platforms/compilers will flag. The template based code that is in mozilla has been very expensive in terms of disruption. It is only because the payoff for the areas where it was decided to use templates was so high that we are glad to have endured the pain. I'm very skeptical of finding additional places where the value of templates will be as clear as in nsCOMPtr. Anyone thinking to use such techniques had certainly better get buy-in from the project leads before jumping into coding. Despite what some experts say, there is great benefit from *mostly* sticking to a fairly simple subset of C++ when employing so many people to build such a large system for so many platforms and with so many varied tool sets. John.
