From: dennis51 AT my-deja DOT com Newsgroups: comp.os.msdos.djgpp Subject: Re: -ftemplate option Date: Mon, 31 Jan 2000 18:25:30 GMT Organization: Deja.com - Before you buy. Lines: 70 Message-ID: <874k2j$tm4$1@nnrp1.deja.com> References: <870epn$33m$1 AT nnrp1 DOT deja DOT com> <3894DADF DOT 1CAE1543 AT caresystems DOT com DOT au> NNTP-Posting-Host: 209.239.193.156 X-Article-Creation-Date: Mon Jan 31 18:25:30 2000 GMT X-Http-User-Agent: Mozilla/4.7 [en] (Win95; U) X-Http-Proxy: 1.0 x22.deja.com:80 (Squid/1.1.22) for client 209.239.193.156 X-MyDeja-Info: XMYDJUIDdennis51 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <3894DADF DOT 1CAE1543 AT caresystems DOT com DOT au>, djgpp AT delorie DOT com wrote: > dennis51 AT my-deja DOT com wrote: > > > redir -eo -x -t gxx -O2 -Wall -ftemplate-depth-75 mono.cpp -o mono.exe > > pardon my approach - would anyone know where one can learn in more detail > about this template option? When you install the compiler, you get a program called info. If you know where to look, info will tell you this: `-ftemplate-depth-N' Set the maximum instantiation depth for template classes to N. A limit on the template instantiation depth is needed to detect endless recursions during template class instantiation. ANSI/ISO C++ conforming programs must not rely on a maximum depth greater than 17. But, I found out about that option in the best possible way: I tried to compile with this: redir -eo -x -t gxx -O2 -Wall mono.cpp -o mono.exe and I got several error messages that looked like this: mono.cpp: In function `void search_sub<1, 1, 17>()': mono.cpp:166: template instantiation depth exceeds maximum of 17 mono.cpp:166: (use -ftemplate-depth-NN to increase the maximum) mono.cpp:166: instantiating `search_sub<1, 1, 18>()' mono.cpp:166: instantiated from `search_sub<1, 1, 17>()' mono.cpp:166: instantiated from `search_sub<1, 1, 16>()' mono.cpp:166: instantiated from `search_sub<1, 1, 15>()' mono.cpp:166: instantiated from `search_sub<1, 1, 14>()' mono.cpp:166: instantiated from `search_sub<1, 1, 13>()' mono.cpp:166: instantiated from `search_sub<1, 1, 12>()' mono.cpp:166: instantiated from `search_sub<1, 1, 11>()' mono.cpp:166: instantiated from `search_sub<1, 1, 10>()' mono.cpp:166: instantiated from `search_sub<1, 1, 9>()' mono.cpp:166: instantiated from `search_sub<1, 1, 8>()' mono.cpp:166: instantiated from `search_sub<1, 1, 7>()' mono.cpp:166: instantiated from `search_sub<1, 1, 6>()' mono.cpp:166: instantiated from `search_sub<1, 1, 5>()' mono.cpp:166: instantiated from `search_sub<1, 1, 4>()' mono.cpp:166: instantiated from `search_sub<1, 1, 3>()' mono.cpp:166: instantiated from `search_sub<1, 1, 2>()' mono.cpp:166: instantiated from `search_sub<1, 1, 1>()' mono.cpp:216: instantiated from here This is perhaps the best error message I have ever gotten out of a compiler. Note that the error message tells exactly what is wrong, AND it tells (almost) exactly what to do to fix it. Who could ask for anything more? I could ask for less, but I won't. (There were a total of 850 lines similar to the above. The program was only 216 lines long. Hmmm, that means that the last number in the error message above is wrong, or, at least, misleading.) Dennis Yelle Please play with my new Java toy: http://www.fortunecity.com/roswell/barada/186/chaos/ (If you and your browser ever do that sort of thing.) Sent via Deja.com http://www.deja.com/ Before you buy.