problems/risks due to programming language

William Thomas Wolfe, 2847 billwolf%hazel.cs.clemson.edu at hubcap.clemson.edu
Sat Feb 24 08:39:40 AEST 1990


>From bitbug at lonewolf.sun.com (James Buster):
> I claim that the possibly erroneous replication of code 
> required by the Ada case statement, e.g.
> 
% -- in approximate Ada style     as compared to C's
% switch foo is                    switch foo 
%     case 5 =>                    {
% 	statement1;                   case 5: 
% 	statement2;                   case 7:
% 	statement3;                     statement1;
%     case 7 =>                         statement2;
% 	statement1;                     statement3;
% 	statement2;                }
% 	statement3;
% end
> 
> is well worth remembering to put in break statements.

   Until one discovers that Ada enables the following construction:

      case foo is   [...]
         when 5 | 7 =>
            statement1;
            statement2;
            statement3;
      end case; 


   Bill Wolfe, wtwolfe at hubcap.clemson.edu



More information about the Comp.lang.c mailing list