This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: is there any way for exit(1)
- From: gfx art <xgrafix at gmail dot com>
- To: "John (Eljay) Love-Jensen" <eljay at adobe dot com>
- Cc: GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 25 Mar 2009 01:25:52 +0200
- Subject: Re: is there any way for exit(1)
- References: <de8aef280903241542k3f332718l99ed43d29c0d297b@mail.gmail.com> <C5EECDC2.39513%eljay@adobe.com>
Thank you very much for your reply.. but I get the same error
List.cpp: In member function ‘void List::erase(int)’:
List.cpp:68: error: ‘exit’ was not declared in this scope
***********************
and this is my member function
#include <iostream>
#include <cassert>
using namespace std;
#include "List.h"
void List::erase(int pos)
{
if (mySize == 0)
{
cerr << "*** List is empty ***\n";
exit(1); // I can't use it
}
if (pos < 0 || pos >= mySize)
{
cerr << "Illegal location to delete -- " << pos
<< ". List unchanged. ***\n";
return;
}
// Shift array elements left to close the gap
for(int i = pos; i < mySize; i++)
myArray[i] = myArray[i + 1];
// Decrease list size
mySize--;
}
Thank you very much for your time and I know how you help others in
open source world
Ali Mirza..
On Wed, Mar 25, 2009 at 12:49 AM, John (Eljay) Love-Jensen
<eljay@adobe.com> wrote:
> Hi gfx art,
>
> Try this...
>
> #include <cstdlib>
>
> if (mySize == CAPACITY)
> {
> ??cerr << "No space" << endl;
> ??std::exit(1)
> }
>
> HTH,
> --Eljay
>