problems/risks due to programming language

John S. Price john at stat.tamu.edu
Fri Feb 23 08:56:36 AEST 1990


In article <8124 at hubcap.clemson.edu> billwolf%hazel.cs.clemson.edu at hubcap.clemson.edu writes:
>> Then why provide the exit statement [in Ada] at all?  
>
>   Suppose that one is in a for loop or a while loop, and some
>   unusual situation arises under which processing cannot continue.
>   The exit statement allows one to conveniently handle such cases.
>

Suppose, in C, that one is in a for loop or a while loop, and
some unusual situation arises under which processing cannot continue.
The break statement allows one to conveniently handle such cases.

But, really, folks, what is the difference between

...
switch(x)
{
  case a: ... break;
  case b: ... break;
}
...

and

...
case foo is
  when x => ...
  when y => ...
...

(I think I remember my Ada correctly... if not, please, it's close enough)?

The control structures case/when have to be terminated somehow.
In Ada, it is terminated by the next when statement.  In C, it's
terminated by a break statement.  Just deal with it.  

Personally, I've found some nice uses of NOT putting a break in
a switch statement, when I have two similiar cases, but one has a
little bit more processing that needs to be done...

This is a *C* newsgroup.  Why talk about the merits and disadvantages
of Ada?  Take it to comp.lang.ada, if there is one.  People like
C.  Who is anyone to tell them (including me) that their opinion is
wrong, or that their preference is wrong?

Give it a rest.

>
>   Bill Wolfe, wtwolfe at hubcap.clemson.edu


--------------------------------------------------------------------------
John Price                   |   It infuriates me to be wrong
john at stat.tamu.edu           |   when I know I'm right....
--------------------------------------------------------------------------



More information about the Comp.lang.c mailing list