Useless instructions: Difference between revisions
Content added Content deleted
(Add Factor) |
(Changed to match new task description) |
||
Line 28: | Line 28: | ||
=={{header|Ada}}== |
=={{header|Ada}}== |
||
The Ada Language Reference Manual Appendix J explains all the features of the language which are largely redundant and are discouraged in newly developed source code. |
|||
The Ada compiler produces warnings for many useless constructs. Eliminating all warnings eliminates most useless constructs. If the parameter passing mode for the parameter in procedure Useless is changed to the OUT mode the compiler generates a compiler '''error''' and the actual parameter must be a variable. The value of an OUT parameter must be assigned within the procedure. |
|||
The features are: |
|||
Ada syntax is case-insensitive, therefore the programmer cannot create a new identifier which differs from another identifier only by letter case. |
|||
<lang Ada>with Ada.Text_IO; use Ada.Text_IO; |
|||
procedure Main is |
|||
procedure Useless (param : in Integer) is -- compiler warning - "param" not referenced |
|||
begin |
|||
if True then |
|||
null; |
|||
else |
|||
Put_Line ("Never called"); -- Warning: this code can never be executed and has been deleted |
|||
end if; |
|||
for I in 2 .. 1 loop -- Compiler warning - loop will not execute |
|||
Put_Line ("Never called"); |
|||
end loop; |
|||
while False loop |
|||
Put_Line ("Never Called"); |
|||
end loop; |
|||
end Useless; |
|||
begin |
|||
Useless (0); |
|||
Put_Line ("Working OK."); |
|||
end Main;</lang> |
|||
{{out}} |
|||
<pre> |
<pre> |
||
- Renaming of library units |
|||
Working OK. |
|||
- Allowed Replacement of Characters |
|||
- Reduced Accuracy Subtypes |
|||
- The Constrained Attribute |
|||
- The package ASCII defined within the package Standard |
|||
- The exception Numeric_Error |
|||
- At Clauses |
|||
- Interrupt Entries |
|||
- Mod Clauses |
|||
- The Storage_Size Attribute |
|||
- Specific Suppression of Checks |
|||
- The Class Attribute of Untagged Incomplete Types |
|||
- Pragma Interface |
|||
- Dependence Restriction Identifiers |
|||
- Character and Wide_Character Conversion Functions |
|||
- Aspect-related Pragmas |
|||
</pre> |
</pre> |
||
The full description of these obsolescent features is described in [http://www.ada-auth.org/standards/12rm/html/RM-J.html] |
|||
=={{header|ALGOL 68}}== |
=={{header|ALGOL 68}}== |