RESOLVE Error-Checking Utility Tutorial

Brad Moore


What is the RECU?

The Resolve Error-Checking Utility (RECU) is a program that catches many of the RESOLVE/C++ errors that the C++ compiler fails to catch.  In some cases, it simply augments the C++ compiler by giving more meaningful error messages (i.e. in the case of missing or mismatched braces).  An important thing to note is that the RECU is not a RESOLVE/C++ parser.  This utility is meant to work alongside the C++ compiler, not to catch all the syntax errors in your C++ code.

How To Use The RECU

The syntax for using the RECU is simple:

RECU < filename

where filename is the name of the file you want to check.

How to Interpret Output

Ideally, your program won't generate any output when it is checked by the RECU.  However, in the case that errors are caught, here's an overview of their format and how to interpret them.

Error Message

Meaning/Causes

Error - Missing parameter mode in header In the parameter list of a procedure or function header, a parameter is missing a parameter mode (i.e. preserves, alters, consumes, produces)
Error - Missing ampersand '&' in header In the parameter list of a procedure or function header, a parameter is missing an ampersand.  For instance, an ampersand is required if the parameter mode is anything other than preserves.  An ampersand is also required if a parameter is a user-defined type such as a Stack or Partial Map.
Error - Missing or non-standard return type in header In a function header, the return type is either not specified, or is a user-defined type.  For example:
global_function Foo();
instead of
global_function Integer Foo();
Error - Missing {}'s around control structure A control structure (i.e. if else or while) is missing {}'s.  For example:
if(x < y)
     x = x + 1;
should actually be
if(x < y)
{
     x = x + 1;
}
Error - Use of invalid C++ keyword Using an invalid C++ keyword such as int or char, instead of Integer and Character
Error - Use of invalid C++ operator Using an invalid C++ operator such as !, &&, or || instead of not, and, and or
Fatal Error - Mismatched Brackets There is a mismatched bracket:
if(x < y)
{
     x = x + 1;
//this should be a '}'
Fatal Error - Unmatched Bracket There is an unmatched bracket:
procedure_body main ()
{
     ... some RESOLVE/C++ code ...
// there's a missing '}' right here
Error - Missing keyword object In RESOLVE/C++ all variable declarations need to be preceded by the keyword object.  For example:
object Integer x;
//and not this
Integer x;
Error - Using '=' instead of '==' A common mistake is to use the assignment operator '=' instead of the Boolean equality operator '=='.  For instance:
if(x = y) is wrong...  It should be if(x == y)
Error - Using '==' instead of '=' Here is an example of a tricky bug the C++ compiler won't catch.  For example:
x == y;
This is a valid C++ expression, but is clearly not what the programmer intended.  It should be:
x = y;
Warning - Possible invalid use of 'else if' In RESOLVE/C++ users are allowed to use 'else if' statements in their code.  However, in some cases using 'else if' statements might be confusing and therefore inappropriate.
For example, the following code is easy to understand:
if(x < y)
{
     if(x < min)
     {
          min = x;
     }
}
else
{
     if(y < min)
     {
          min = y;
     }
}

The following code does the same thing, but the 'else if' makes the code harder to read:
if(x < y)
{
     if(x < min)
     {
          min = x;
    
}
}
else if(y < min)
{
          min = y;
}
 
The whole point of this warning is to remind you to think about your code's readability.  If you aren't sure whether or not your 'else if' statement might be confusing, be safe and break it up into two statements.
Fatal Error - EOF not expected This error message should only be generated when there is a basic problem in the syntax of the code that the RECU was not meant to catch.  Hopefully, the C++ compiler will produce a message that might help locate the problem code.


 


Last modified: Sat Jan 19 12:23:36 EST 2003