typeof for vintage compilers

Hi. I started working on implementing remove_bounds for the VC 6.5 compiler, and found that the source had all the similarities of Arkadiys typeof implementation, so I have implemented typeof for compilers not supporting partial specialization. I took many ideas from Arkadiys implementation, but I had to rewrite the encoding part from scratch. The library (apart from being incomplete with respect to function types etc) has the following key elements in place: encoding/decoding of: -fundamental types -template types -modifiers (*&const volatile []) The library has a few improvements that could perhaps be implemented in Arkadiys typeof implementation as well: The max depth of an expression increased from the mpl limit of 60 to the preprocessor limit of 256 template expressions containing integral values are allowed The template: template<typename T,unsigned long V> struct X {}; can be exposed to typeof in the following way: BOOST_TYPEOF_DEFINE_TEMPLATE(X,2,(typename,unsigned long)) (VC 7.1 had some problems preprocessing the code needed to make this work.) The source is available at: http://groups.yahoo.com/group/boost/files/typeof_vintage.zip I have compiled the library for VC 6.5 and 7.0. They both fail when the depth of an expression gets too large, with the error message: fatal error C1045: compiler limit : linkage specifications nested too deeply. -- Peder Holt

"Peder Holt" <peder.holt@gmail.com> wrote
I have implemented typeof for compilers not supporting partial specialization.
Before taking a closer look at your code, I assume that the only way to emulate partial template specialization is by employing template function overloading (I've done it once in the past)... If this is what you did, I wonder if base-derived classes are handled correctly...
The max depth of an expression increased from the mpl limit of 60 to the preprocessor limit of 256
Is this a real limit in MPL? I've always gotten 50, but I assumed it should be easy to lift... Seems unreasonably low... Can MPL experts comment on this?
template expressions containing integral values are allowed
The template: template<typename T,unsigned long V> struct X {}; can be exposed to typeof in the following way: BOOST_TYPEOF_DEFINE_TEMPLATE(X,2,(typename,unsigned long))
This is cool, I will definitely try to implement something similar.
(VC 7.1 had some problems preprocessing the code needed to make this work.)
This will have to be solved, though, I believe this compiler deserves not to be overlooked :) Regards, Arkadiy

On Fri, 20 Aug 2004 18:44:41 -0400, Arkadiy Vertleyb <vertleyb@hotmail.com> wrote:
"Peder Holt" <peder.holt@gmail.com> wrote
I have implemented typeof for compilers not supporting partial specialization.
Before taking a closer look at your code, I assume that the only way to emulate partial template specialization is by employing template function overloading (I've done it once in the past)... If this is what you did, I wonder if base-derived classes are handled correctly...
Yes, that is right, I will have to test it out. But there are two ways of using functions to implement typeof: 1: Create functions that returns the encoded size of element #N in the expression This is what I have currently done, and VC chokes on it, as it recurses too deeply. 2: Create functions that return the type of element #N, and then encode this type. This requires that all the recursion be done in the typeof macro. To get the type of element #3 you would have to do something like: encode(foo(foo(foo(make_foo(expression)))); It seems VC likes that better. I'll try to follow that approach.
The max depth of an expression increased from the mpl limit of 60 to the preprocessor limit of 256
Is this a real limit in MPL? I've always gotten 50, but I assumed it should be easy to lift... Seems unreasonably low...
Can MPL experts comment on this?
template expressions containing integral values are allowed
The template: template<typename T,unsigned long V> struct X {}; can be exposed to typeof in the following way: BOOST_TYPEOF_DEFINE_TEMPLATE(X,2,(typename,unsigned long))
This is cool, I will definitely try to implement something similar.
(VC 7.1 had some problems preprocessing the code needed to make this work.)
This will have to be solved, though, I believe this compiler deserves not to be overlooked :)
Have fixed this. http://groups.yahoo.com/group/boost/files/typeof_vintage.zip Everything now compiles on VC 7., except the compiler hangs when the typeof depth is set to a large number (e.g. 60)
Regards,
Arkadiy
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

<snip>
But there are two ways of using functions to implement typeof: 1: Create functions that returns the encoded size of element #N in the expression This is what I have currently done, and VC chokes on it, as it recurses too deeply. 2: Create functions that return the type of element #N, and then encode this type. This requires that all the recursion be done in the typeof macro. To get the type of element #3 you would have to do something like: encode(foo(foo(foo(make_foo(expression)))); It seems VC likes that better. I'll try to follow that approach.
It turns out that this was the correct approach. VC does not complain, and the source gets much more compact and simple. In addition, this solution automatically solves the problem with base/derived class registration, as I rely on functions returning function pointers. <snip> -- Peder Holt
participants (2)
-
Arkadiy Vertleyb
-
Peder Holt