Manual: Minor refactorings. Added a simple build script
This commit is contained in:
parent
469a8e4032
commit
2cbda0cfe4
|
@ -0,0 +1,8 @@
|
||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
xsltproc -o manual.html /usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl manual.docbook
|
||||||
|
|
||||||
|
xsltproc -o intermediate-fo-file.fo /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl manual.docbook
|
||||||
|
|
||||||
|
fop -pdf manual.pdf -fo intermediate-fo-file.fo
|
||||||
|
|
|
@ -423,6 +423,24 @@ void DestroyFred(void *p)
|
||||||
<para>If an exception occurs when <literal>b</literal> is allocated,
|
<para>If an exception occurs when <literal>b</literal> is allocated,
|
||||||
<literal>a</literal> will leak.</para>
|
<literal>a</literal> will leak.</para>
|
||||||
|
|
||||||
<para></para>
|
<para>Here is another example:</para>
|
||||||
|
|
||||||
|
<programlisting>int *p;
|
||||||
|
|
||||||
|
int a(int sz)
|
||||||
|
{
|
||||||
|
delete [] p;
|
||||||
|
if (sz <= 0)
|
||||||
|
throw std::runtime_error("size <= 0");
|
||||||
|
p = new int[sz];
|
||||||
|
}</programlisting>
|
||||||
|
|
||||||
|
<para>Check that with Cppcheck:</para>
|
||||||
|
|
||||||
|
<programlisting>cppcheck --enable=exceptNew,exceptRealloc except2.cpp</programlisting>
|
||||||
|
|
||||||
|
<para>The output from Cppcheck is:</para>
|
||||||
|
|
||||||
|
<programlisting>[except2.cpp:7]: (error) Throwing exception in invalid state, p points at deallocated memory</programlisting>
|
||||||
</chapter>
|
</chapter>
|
||||||
</book>
|
</book>
|
||||||
|
|
Loading…
Reference in New Issue