The nightmare never ends… in the beginning writing C++ for the GCC was better than MSVC. The template support was much better. To be exact the C++ compiler of Visual Studio 6 had minimal support for templates. You could do something in GCC and then find out that it doesn’t compile under Visual Studio 6. Back then you had at least the fun of blaming Microsoft for that, which is was always cool…
Now with the Visual Studio .NET the C++ support is SUPERB… to the point that parts are reversed… You code in .NET and pray it also works on GCC. What I had recently… When I was implementing the serialization support for Sylphis I was using MSVC.NET (Actually it is my primary working environment for Sylphis and I often go back to Linux and try if things work there). The code below is a template method that compiles and works fine in .NET…
55:template<class Cont>
56: void writeContainer(const Cont &cont) {
57: writeUnsignedInt(cont.size());
58: Cont::const_iterator i;
59: for(i = cont.begin() ; i != cont.end() ; ++i){
60: writeSerializable(*i);
61: }
62: }
When I tried GCC (version 3.3.5) yesterday (and a log time since the last try) I got this error :
include/serializer.h:58: error: parse error before `;' token
Isn’t the world of portable code so interesting?
Any ideas?
UPDATE : The problem is solved so don’t let this post confuse you. Check my The rematch post…