Author |
Message |
Silent Avenger
![](http://compsci.ca/v3/uploads/user_avatars/15799977747577a0b762ca.jpg)
|
Posted: Thu Jan 11, 2007 10:02 pm Post subject: Would this be considered proper form? |
|
|
I'm working on a program and I have a dynamic array being used I'm just wondering if it would be considered proper to run a loop until an overflow error occurs and use error handling code. I asked my teacher and he sad he wasn't sure if it was proper practice to purposely create and error, any help would be great. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
rdrake
![](http://compsci.ca/v3/uploads/user_avatars/113417932472fc6c9cd916.png)
|
Posted: Thu Jan 11, 2007 10:12 pm Post subject: RE:Would this be considered proper form? |
|
|
Creating an error on purpose means that one is too lazy to read up on another way 99.9% of the time. That 0.1% is only for times when it is absolutely necessary. |
|
|
|
|
![](images/spacer.gif) |
Silent Avenger
![](http://compsci.ca/v3/uploads/user_avatars/15799977747577a0b762ca.jpg)
|
Posted: Thu Jan 11, 2007 10:26 pm Post subject: Re: Would this be considered proper form? |
|
|
It's not that I'm too lazy it's just there is no other way I can display the array other than creating an error and I've spent the past couple days trying to get around it. The problem is that I'm using many different variables to adjust the size of the array. |
|
|
|
|
![](images/spacer.gif) |
rdrake
![](http://compsci.ca/v3/uploads/user_avatars/113417932472fc6c9cd916.png)
|
Posted: Thu Jan 11, 2007 11:22 pm Post subject: RE:Would this be considered proper form? |
|
|
More information on the problem you are trying to solve would help. Perhaps there is another way of doing it? ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
Silent Avenger
![](http://compsci.ca/v3/uploads/user_avatars/15799977747577a0b762ca.jpg)
|
Posted: Thu Jan 11, 2007 11:35 pm Post subject: Re: Would this be considered proper form? |
|
|
Well there is another way of doing it but then I have to add in even more variables and then the issue of efficiency comes up. So what would be more efficient in terms of memory and processing power for adding items to a list from an array? Having 6 more variables, 2 boolean and 4 integer or just having a loop that will handle the error of subscript out of range? |
|
|
|
|
![](images/spacer.gif) |
cool dude
![](http://www.taylorstrategicmarketing.com/images/king.jpg)
|
Posted: Thu Jan 11, 2007 11:48 pm Post subject: Re: Would this be considered proper form? |
|
|
you know there might be a much easier way to do it and you just don't see it yet. keep trying to figure it out. If your still stumped post your code and we can have a look at it. |
|
|
|
|
![](images/spacer.gif) |
rdrake
![](http://compsci.ca/v3/uploads/user_avatars/113417932472fc6c9cd916.png)
|
Posted: Thu Jan 11, 2007 11:52 pm Post subject: RE:Would this be considered proper form? |
|
|
Use the extra variables. I do not see how looping through until you reach a state of error would be more efficient. |
|
|
|
|
![](images/spacer.gif) |
Silent Avenger
![](http://compsci.ca/v3/uploads/user_avatars/15799977747577a0b762ca.jpg)
|
Posted: Thu Jan 11, 2007 11:52 pm Post subject: Re: Would this be considered proper form? |
|
|
Ok I'll keep trying to figure out another way but is creating an error on purpose really that bad? I know when you use the commondialog control there are some cases when you need an error to be created when the cancel button is clicked. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|