# Simple calculator. -*- Autotest -*-
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-# 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
%code
{
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_UNISTD_H
are stored in a union, from which objects with constructors are
excluded in C++. */
%initial-action {
- @$.initialize (0);
+ @$.initialize ();
}
])])[
power (int base, int exponent)
{
int res = 1;
- if (exponent < 0)
- exit (3);
+ assert (0 <= exponent);
for (/* Niente */; exponent; --exponent)
res *= base;
return res;