Thursday, December 19, 2002

Geek Alert



Working with older compilers can be such fun. Cygnus 2.90 C++ had only partially implemented member template functions, so attempting to call them thusly:





Foo foo;





foo.bar < int > ();






caused a compiler error: "parse error before `>'".





At the same time, there is a feature in ISO Standard C++, the '.template' mechanism, meant to be used inside function templates when an object depends on a template parameter. Doing this:





foo.template bar < int > ();





causes the program to compile, and work as expected, even though the '.template' mechanism shouldn't apply to this case. One 'bug' fixes another.



No comments:

Post a Comment