[Cmake] Can I use CMAKE_COMPILER_IS_GNUCXX
Brad King
brad.king at kitware.com
Tue Sep 17 13:55:29 EDT 2002
> It may... never timed it. 'Course I can't imagine why there is a limit
> anyway. I would guess that it would increase the memory usage of the
> compiler not necessary the speed.
The limit is to allow the compiler to detect infinite loops of
instantiation:
template <int I>
struct Foo: public Foo<I-1>
{
};
template <>
struct Foo<0>
{
};
typedef Foo<10> Foo10; // works fine due to sentinel at Foo<0>
typedef Foo<-1> FooN1; // infinate instantiation depth
The writers of the standard required only 17 (or so) as a limit as an
implementation minimum. At the time, they didn't imagine these complex
template-metaprogramming techniques that have since been discovered.
MSVC doesn't implement a limit. In fact, I've found that it is possible
to crash the IDE's editor by writing code like the above. When the editor
goes to do lookup of a class's members for the bubble-help, it gets in an
infinite loop and eventually stack overflows!
-Brad
More information about the CMake
mailing list