Nieminen Juha wrote:
> You are right.
> However I think there are some places where the use of goto (at least in
> C and C++) is more or less reasonable:
>
> - Case 1:
>
> for(cond1)
> for(cond2)
> while(cond3)
> if(skip) goto end_loops;
>
> end_loops:
> ...
>
> - Case 2:
>
> recalculate_initial_values:
> make_some_calculations;
> for(cond1)
> for(cond2)
> while(cond3)
> if(wrong_values) goto recalculate_initial_values;
>
> - Case 3:
>
> calculation1;
> if(error) goto end_calculations;
> calculation2;
> if(error) goto end_calculations;
> calculation3;
> if(error) goto end_calculations;
> calculation4;
> if(error) goto end_calculations;
>
> handle_results;
>
> end_calculations:
> clean_up;
Of those, only case 3 looks like possibly decent use. Case 1 and 2 look very
problematic.
--
"My new computer's got the clocks, it rocks
But it was obsolete before I opened the box" - W.A.Y.
Post a reply to this message
|