21 lines
532 B
XML
21 lines
532 B
XML
<?xml version='1.0' encoding='utf-8' ?>
|
|
<!DOCTYPE programlisting PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
|
]>
|
|
<!-- Automatically generated file. Do not edit. -->
|
|
<programlisting language="C">
|
|
void report_overflow(void);
|
|
|
|
int
|
|
add(int a, int b)
|
|
{
|
|
int result = a + b;
|
|
if (a < 0 || b < 0) {
|
|
return -1;
|
|
}
|
|
// The compiler can optimize away the following if statement.
|
|
if (result < 0) {
|
|
report_overflow();
|
|
}
|
|
return result;
|
|
}
|
|
</programlisting>
|