Re: template related query
On Oct 18, 9:48 pm, Hendrik Schober <spamt...@gmx.de> wrote:
James Kanze wrote:
On Oct 15, 1:46 pm, Hendrik Schober <spamt...@gmx.de> wrote:
Kai-Uwe Bux wrote:
[...] I get compiler errors almost all the time,
but I have found only 10 compiler bugs so far.
You need to do more porting. Or more template stuff. Or
both. :)
It depends on what his boss is paying him to do: write
working (and maintainable) code, or stress test compilers.
With modern compilers, it's actually fairly rare to stumble
on a compiler bug unless you're pushing the envelope well
beyond what is reasonable in a normal production
environment.
In the last decade I have written code that needed to compile
using several versions of Borland, Microsoft, Metrowerks, GCC,
multiplied with several std lib implementations (and versions
thereof) and, at least with GCC, several platforms.
There are two ways of doing that. One is writing very up to
date C++, with platform dependent work-arounds for errors or
unsupported features. The other is to simply write code using
the common subset of C++ which actually works on all target
compilers. Twenty-five or thirty years ago, the common subset
which worked was very, very small---if you throw in g++ 1.49
(the first compiler I used professionally), it didn't even
include local variables with a destructor. Today, it's a
reasonable subset for most uses, even if you throw in what are
today some very old compilers. And most applications should
take this approach. There are exceptions---some of what Boost
tries to do is intentially pushing the envelope, for example,
legitimately. But be aware that pushing the envelope can be
very expensive, and most commercial operations won't reap any
real benefit from the added cost.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34