View Single Post
Join Date: Apr 2004
Posts: 4,314
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 229
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Return Array from C++

 
0
  #9
May 11th, 2004
C++ is not my native tongue, but I'll mention a couple of things and try to wade through the linter's output.

First, I believe you are trying to delete the objects twice. Once in main(), and then again in the destructor when the object goes out of scope.

[edit1]
  1. if ( index < 0 || index >= LENGTH )
  2. cout << "INVALID INDEX" << endl;
  3. array[index] = value;
Here you may attempt to access out of array bounds.
[/edit1]

[edit2]
 Array()
{
	 array = new int(LENGTH);
}
I think you want the square brackets.
 Array()
{
	 array = new int[LENGTH];
}
[/edit2]

[edit3]
Lint:
[Info 1732] new in constructor for class 'Array' which has no assignment operator
[Info 1733] new in constructor for class 'Array' which has no copy constructor
I forget why, but it's right.
[/edit3]
Reply With Quote