📄 destr.html
字号:
<HTML><HEAD><TITLE>Newmat09 - destruct</TITLE></HEAD><BODY><H2>Destruction of temporaries</H2><A HREF="calc.html"> next</A> -<A HREF="calc.html"> skip</A> -<A HREF="design.html"> up</A> -<A HREF="index.html"> start</A><P>Versions before version 5 of newmat did not work correctlywith Gnu C++ (version 5 or earlier). This was because the treestructure used torepresent a matrix expression was set up on the stack. This wasfine for AT&T, Borland and Zortech C++.<P>However early version Gnu C++ destroys temporary structures as soon as thefunction that accesses them finishes. The other compilers waituntil the end of the current expression or current block. Toovercome this problem, there is now an option to store thetemporaries forming the tree structure on the heap (created withnew) and to delete them explicitly. Activate the definition of TEMPS_DESTROYED_QUICKLYto set this option.<P>In fact, I suggest this be the default option as, with it, thepackage uses less storage and runs faster. There still existsituations Gnu C++ will go wrong. These include statements like<PRE> A = X * Matrix(P * Q); Real r = (A*B)(3,4);</PRE>Neither of these kinds of statements will occur often inpractice.<P>Now that the C++ standards committee has said that temporary structures shouldnot be destroyed before a statement finishes, my policy needs to be re-evaluated.Probably, I'll return to using the stack, because of the difficulty of managingexceptions with the heap version. <P><A HREF="calc.html"> next</A> -<A HREF="calc.html"> skip</A> -<A HREF="design.html"> up</A> -<A HREF="index.html"> start</A><P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -