C
Christopher
I am getting a parse error from g++ pointing at my catch line and can't
figure out whats wrong with this code:
#include "BigPosInt.h"
#include <iostream>
#include <new>
#include <assert.h>
BigPosInt::BigPosInt(int init_max_digits)
{
assert(init_max_digits > 0);
try
{
digitsArray = new int[init_max_digits];
}
catch(bad_alloc a)
{
const char* temp = a.what();
std::cout<<"\n\n"<<temp<<"\n";
std::cout<<"Insufficient free memory. \n\n";
}
// Postcondition: constructed BigPosInt has been initialized to
// represent the value 0 and can accommodate any
// BigPosInt that has up to init_max_digits digits
}
Any ideas?
thanx,
Christopher
figure out whats wrong with this code:
#include "BigPosInt.h"
#include <iostream>
#include <new>
#include <assert.h>
BigPosInt::BigPosInt(int init_max_digits)
{
assert(init_max_digits > 0);
try
{
digitsArray = new int[init_max_digits];
}
catch(bad_alloc a)
{
const char* temp = a.what();
std::cout<<"\n\n"<<temp<<"\n";
std::cout<<"Insufficient free memory. \n\n";
}
// Postcondition: constructed BigPosInt has been initialized to
// represent the value 0 and can accommodate any
// BigPosInt that has up to init_max_digits digits
}
Any ideas?
thanx,
Christopher