So you've finally written your very own C++ program. And you've heeded all the words of the C++ gurus: it uses STL containers and iterators (although you're careful not to inherit from these, for various arcane reasons). It just remains to compile your masterpiece. Should be easy enough -- after all, you were careful to write a standards-compliant program.

Umm, sorry. Did you say "compile"?!

That might be a bit tricky...

You see, you're writing C++. And there don't actually exist any C++ compilers. MS VC++ (that's Visual C++) is said not to support member function templates, which are required to write many useful template classes. This also means it cannot compile the STL. Sun's CC compiler is "getting better all the time". In English, this means it's not there yet. The same for any other UN*X vendor's compiler that I've touched (usually with a long pole) so far.

So you can use GNU gcc. Get the very very latest version (2.95.2; here "odd second number" doesn't mean unstable, but that's a fault of lack of stable systems for version numbers rather than C++). The compiler is nearer the standard than any other mainstream compiler. But the library still isn't C++, especially in iostreams (that's I/O for all you non-standards-compliant folk). It is said you can compile STLport with gcc to get something very close to the standard. But still, "compiling" is not the same as "conforming". And gcc gets something as simple as

class A {
  private:
    class B {
      // ...
    public:
      B() { ... };
    };
  // ...
};

A::B ab;       // illegal, since "class B" is private in A!
wrong! It agrees to compile this, when A::B may only be used inside A and its friends, as it's private. So much for hiding implementation details in your library.

Then there are somewhat more exotic things you can try, like KAI's compiler or Comeau C++. They seem to be seeking the standard, but still aren't there (yet).

AND, all these cross-platform compilers can leave much to be desired performance-wise. Because, you see, gcc produces suboptimal code on many architectures (like DEC alphas or SGI's R10000). And it's doubtful how well-tuned a vendor- and compiler-neutral implementation of the STL will be. Of course, the whole idea of writing standard code is that it will compile well on any platform that supports the standard.

Too bad there aren't any.

Log in or registerto write something here or to contact authors.