

|
 |
| Programming > C++ Moderated > Re: Meyers effe... |
|
| << Topic |
< Post |
Post 3 of 9 Topic 9501 of 9830
|
Post > |
Topic >> |
Re: Meyers effective C++, templates, np-complete
by =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@[EMAIL PROTECTED]
Apr 15, 2008 at 12:29 PM
| On 15 Apr., 05:22, Todd Mars <tamn...@[EMAIL PROTECTED]
> wrote:
> Scott Meyers in Effective C++ at the start of the templates section
> says that C++ templates are np-complete in the compiler processing.
> Does this mean that the use of templates can cause the compile to
> execute for an infinite loop or near infinite loop?
> Todd.
Yes, that could be possible. But the standard has foreseen this
situation and has defined a "barrier" to prevent this[1], e.g.
[temp.inst]/14:
"There is an implementation-defined quantity that specifies the limit
on the total
depth of recursive instantiations, which could involve more than one
template.
The result of an infinite recursion in instantiation is undefined."
HTH & Greetings from Bremen,
Daniel Krügler
[1]: "Prevent" does mean here, that the standard moves any such
happening
out of the scope of the standard.
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


|
9 Posts in Topic:
|
Todd Mars <tamnt54@[EM |
2008-04-14 21:22:01 |
|
Carl Barron <cbarron41 |
2008-04-15 12:28:24 |
|
=?ISO-8859-1?Q?Daniel_Kr= |
2008-04-15 12:29:15 |
|
Marcin.Barczynski@[EMAIL |
2008-04-15 12:32:41 |
|
Thomas Richter <thor@[ |
2008-04-15 12:31:09 |
|
Mathias Gaunard <loufo |
2008-04-15 12:32:35 |
|
Edward Rosten <Edward. |
2008-04-15 12:34:17 |
|
"Martin T." < |
2008-04-15 12:43:13 |
|
Vidar Hasfjord <vattil |
2008-04-16 11:38:44 |
|
Post A Reply:

|
|
|
|