40 lines
482 B
Plaintext
40 lines
482 B
Plaintext
void
|
|
ft(integer a, text &s)
|
|
{
|
|
if (a & 1) {
|
|
s = "odd";
|
|
error("bad number");
|
|
} elif (a & a - 1) {
|
|
s = "not a power of two";
|
|
error("bad number");
|
|
}
|
|
}
|
|
|
|
void
|
|
fc(integer a)
|
|
{
|
|
text e;
|
|
|
|
if (trap(ft, a, e)) {
|
|
v_text("exception of type `");
|
|
v_text(e);
|
|
v_text("' thrown for ");
|
|
v_integer(a);
|
|
v_newline();
|
|
} else {
|
|
v_text("no exception thrown for ");
|
|
v_integer(a);
|
|
v_newline();
|
|
}
|
|
}
|
|
|
|
integer
|
|
main(void)
|
|
{
|
|
fc(5);
|
|
fc(6);
|
|
fc(8);
|
|
|
|
return 0;
|
|
}
|